Giter VIP home page Giter VIP logo

acceptance-tests's Introduction

A modular, open-source search engine for our world.

Pelias is a geocoder powered completely by open data, available freely to everyone.

Local Installation · Cloud Webservice · Documentation · Community Chat

What is Pelias?
Pelias is a search engine for places worldwide, powered by open data. It turns addresses and place names into geographic coordinates, and turns geographic coordinates into places and addresses. With Pelias, you’re able to turn your users’ place searches into actionable geodata and transform your geodata into real places.

We think open data, open source, and open strategy win over proprietary solutions at any part of the stack and we want to ensure the services we offer are in line with that vision. We believe that an open geocoder improves over the long-term only if the community can incorporate truly representative local knowledge.

Pelias

A modular, open-source geocoder built on top of Elasticsearch for fast and accurate global search.

What's a geocoder do anyway?

Geocoding is the process of taking input text, such as an address or the name of a place, and returning a latitude/longitude location on the Earth's surface for that place.

geocode

... and a reverse geocoder, what's that?

Reverse geocoding is the opposite: returning a list of places near a given latitude/longitude point.

reverse

What are the most interesting features of Pelias?

  • Completely open-source and MIT licensed
  • A powerful data import architecture: Pelias supports many open-data projects out of the box but also works great with private data
  • Support for searching and displaying results in many languages
  • Fast and accurate autocomplete for user-facing geocoding
  • Support for many result types: addresses, venues, cities, countries, and more
  • Modular design, so you don't need to be an expert in everything to make changes
  • Easy installation with minimal external dependencies

What are the main goals of the Pelias project?

  • Provide accurate search results
  • Work equally well for a small city and the entire planet
  • Be highly configurable, so different use cases can be handled easily and efficiently
  • Provide a friendly, welcoming, helpful community that takes input from people all over the world

Where did Pelias come from?

Pelias was created in 2014 as an early project at Mapzen. After Mapzen's shutdown in 2017, Pelias is now part of the Linux Foundation.

How does it work?

Magic! (Just kidding) Like any geocoder, Pelias combines full text search techniques with knowledge of geography to quickly search over many millions of records, each representing some sort of location on Earth.

The Pelias architecture has three main components and several smaller pieces.

A diagram of the Pelias architecture.

Data importers

The importers filter, normalize, and ingest geographic datasets into the Pelias database. Currently there are six officially supported importers:

We are always discussing supporting additional datasets. Pelias users can also write their own importers, for example to import proprietary data into your own instance of Pelias.

Database

The underlying datastore that does most of the query heavy-lifting and powers our search results. We use Elasticsearch. Currently versions 7 and 8 are supported.

We've built a tool called pelias-schema that sets up Elasticsearch indices properly for Pelias.

Frontend services

This is where the actual geocoding process happens, and includes the components that users interact with when performing geocoding queries. The services are:

  • API: The API service defines the Pelias API, and talks to Elasticsearch or other services as needed to perform queries.
  • Placeholder: A service built specifically to capture the relationship between administrative areas (a catch-all term meaning anything like a city, state, country, etc). Elasticsearch does not handle relational data very well, so we built Placeholder specifically to manage this piece.
  • PIP: For reverse geocoding, it's important to be able to perform point-in-polygon(PIP) calculations quickly. The PIP service is is very good at quickly determining which admin area polygons a given point lies in.
  • Libpostal: Pelias uses the libpostal project for parsing addresses using the power of machine learning. We use a Go service built by the Who's on First team to make this happen quickly and efficiently.
  • Interpolation: This service knows all about addresses and streets. With that knowledge, it is able to supplement the known addresses that are stored directly in Elasticsearch and return fairly accurate estimated address results for many more queries than would otherwise be possible.

Dependencies

These are software projects that are not used directly but are used by other components of Pelias.

There are lots of these, but here are some important ones:

  • model: provide a single library for creating documents that fit the Pelias Elasticsearch schema. This is a core component of our flexible importer architecture
  • wof-admin-lookup: A library for performing administrative lookup using point-in-polygon math. Previously included in each of the importers but now only used by the PIP service.
  • query: This is where most of our actual Elasticsearch query generation happens.
  • config: Pelias is very configurable, and all of it is driven from a single JSON file which we call pelias.json. This package provides a library for reading, validating, and working with this configuration. It is used by almost every other Pelias component
  • dbclient: A Node.js stream library for quickly and efficiently importing records into Elasticsearch

Helpful tools

Finally, while not part of Pelias proper, we have built several useful tools for working with and testing Pelias

Notable examples include:

  • acceptance-tests: A Node.js command line tool for testing a full planet build of Pelias and ensuring everything works. Familiarity with this tool is very important for ensuring Pelias is working. It supports all Pelias features and has special facilities for testing autocomplete queries.
  • compare: A web-based tool for comparing different instances of Pelias (for example a production and staging environment). We have a reference instance at pelias.github.io/compare/
  • dashboard: Another web-based tool for providing statistics about the contents of a Pelias Elasticsearch index such as import speed, number of total records, and a breakdown of records of various types.

Documentation

The main documentation lives in the pelias/documentation repository.

Additionally, the README file in each of the component repositories listed above provides more detail on that piece.

Here's an example API response for a reverse geocoding query
$ curl -s "search.mapzen.com/v1/reverse?size=1&point.lat=40.74358294846026&point.lon=-73.99047374725342&api_key={YOUR_API_KEY}" | json
{
    "geocoding": {
        "attribution": "https://search.mapzen.com/v1/attribution",
        "engine": {
            "author": "Mapzen",
            "name": "Pelias",
            "version": "1.0"
        },
        "query": {
            "boundary.circle.lat": 40.74358294846026,
            "boundary.circle.lon": -73.99047374725342,
            "boundary.circle.radius": 500,
            "point.lat": 40.74358294846026,
            "point.lon": -73.99047374725342,
            "private": false,
            "querySize": 1,
            "size": 1
        },
        "timestamp": 1460736907438,
        "version": "0.1"
    },
    "type": "FeatureCollection",
    "features": [
        {
            "geometry": {
                "coordinates": [
                    -73.99051,
                    40.74361
                ],
                "type": "Point"
            },
            "properties": {
                "borough": "Manhattan",
                "borough_gid": "whosonfirst:borough:421205771",
                "confidence": 0.9,
                "country": "United States",
                "country_a": "USA",
                "country_gid": "whosonfirst:country:85633793",
                "county": "New York County",
                "county_gid": "whosonfirst:county:102081863",
                "distance": 0.004,
                "gid": "geonames:venue:9851011",
                "id": "9851011",
                "label": "Arlington, Manhattan, NY, USA",
                "layer": "venue",
                "locality": "New York",
                "locality_gid": "whosonfirst:locality:85977539",
                "name": "Arlington",
                "neighbourhood": "Flatiron District",
                "neighbourhood_gid": "whosonfirst:neighbourhood:85869245",
                "region": "New York",
                "region_a": "NY",
                "region_gid": "whosonfirst:region:85688543",
                "source": "geonames"
            },
            "type": "Feature"
        }
    ],
    "bbox": [
        -73.99051,
        40.74361,
        -73.99051,
        40.74361
    ]
}

How can I install my own instance of Pelias?

To try out Pelias quickly, use our Docker setup. It uses Docker and docker-compose to allow you to quickly set up a Pelias instance for a small area (by default Portland, Oregon) in under 30 minutes.

Do you offer a free geocoding API?

You can sign up for a trial API key at Geocode Earth. A commercial service has been operated by the core development team behind Pelias since 2014 (previously at search.mapzen.com). Discounts and free plans are available for free and open-source software projects.

What's it built with?

Pelias itself (the import pipelines and API) is written in Node.js, which makes it highly accessible for other developers and performant under heavy I/O. It aims to be modular and is distributed across a number of Node packages, each with its own repository under the Pelias GitHub organization.

For a select few components that have performance requirements that Node.js cannot meet, we prefer to write things in Go. A good example of this is the pbf2json tool that quickly converts OSM PBF files to JSON for our OSM importer.

Elasticsearch is our datastore of choice because of its unparalleled full text search functionality, scalability, and sufficiently robust geospatial support.

Contributing

Gitter

We built Pelias as an open source project not just because we believe that users should be able to view and play with the source code of tools they use, but to get the community involved in the project itself.

Especially with a geocoder with global coverage, it's just not possible for a small team to do it alone. We need you.

Anything that we can do to make contributing easier, we want to know about. Feel free to reach out to us via Github, Gitter, email, or Twitter. We'd love to help people get started working on Pelias, especially if you're new to open source or programming in general.

We have a list of Good First Issues for new contributors.

Both this meta-repo and the API service repo are worth looking at, as they're where most issues live. We also welcome reporting issues or suggesting improvements to our documentation.

The current Pelias team can be found on Github as missinglink and orangejulius.

Members emeritus include:

acceptance-tests's People

Contributors

avulfson17 avatar dianashk avatar greenkeeper[bot] avatar greenkeeperio-bot avatar heffergm avatar hkrishna avatar joxit avatar missinglink avatar orangejulius avatar riordan avatar sevko avatar tigerlily-he avatar tpedelose avatar trescube avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acceptance-tests's Issues

exclude 'feedback' test cases

it would be handy if I could run the tests without also running all the 'feedback' cases, my current hacky solution is:

> rm test_cases/feedback*
> node test -e stage
> git checkout test_cases/feedback*

maybe we could add an 'exclude' flag to the cli?

Diversify geography & language of acceptance tests

Tests are very New-Yorky. Not that it's a bad thing to have adequate coverage of the greatest city in the world, but we should expand the test set to be more broadly representative and globally inclusive.

Find new test case for missing postalcode

One of our test cases needs a little help, and all that's required is knowledge of some place on Earth that uses postal codes. We're hoping it can be someone from our community!

🌍 What are we testing?

Much of the data we import into Pelias has postal code information, but not all of it. Unfortunately this presents us with a problem: users can perform searches for an address with a postalcode, and we might know about that address, but we might not know its postcode.

This happens fairly frequently right now, and we don't expect to have perfect data everywhere, well...ever. Fortunately, Pelias should be able to find the place a user is looking for, even if they type in the postalcode but its not in the data. To ensure this works, we have a test case for it. But right now it's broken. :(

📈 What changed?

In short, open data got better! A new data source was added for the part of Florida that includes the current test, and it adds postalcodes! Overall this is great, but this specific test requires that we don't have the postalcode for an address, or it doesn't work. We need a new test case.

💌 How to help out

We need people that can find an address in our data that doesn't have a postal code associated with it, and also happen to know what the postal code for that address should actually be. It doesn't have to be in the USA (there are postalcodes all over the world!).

The fastest way to find areas you might know about that have good data coverage might be to look at the OpenAddresses dot map. It's at the bottom of the page and shows a dot for every single address OpenAddresses knows about. We import all OpenAddresses data so it's also a good indicator of our coverage.

After that, try running some queries using our compare app. Here's a link to the address we're currently using. Try typing in some addresses you know about (without the postalcode).

If Pelias doesn't know about the address at all, none of the results will match what you typed in. But if we do know about it, a couple of the results (hopefully at the top, but maybe not) will match. Read through each one, and see if it has a postalcode property with the correct postalcode. If any of them do, then it's the same problem of open data being too good for this test. 🎉. So try another one and hopefully you can find an address that doesn't have a postalcode.

One important sidenote: please don't use any other geocoders that use proprietary data to find a good test case. There's a famous one who's name starts with G and ends with oogle that you may have heard about. Using proprietary data to make open data better is against the terms of service of those tools. It's also not really in the spirit of open data.

💻 What the updated test will look like?

Our tests are written in JSON, so updating them doesn't require writing any code. In fact for this test, you won't need to change the structure of the test at all, just update some of the values.

The test case currently looks like this:

 {
      "id": 2,
      "status": "fail",
      "user": "Julian",
      "type": "dev",
      "notes": "Desired document has no zipcode, but should be 33801. If we ever get better data, find a new test case",
      "in": {
        "text": "440 S Combee Rd, Lakeland, FL 33801"
      },
      "expected": {
        "properties": [
          {
            "name": "440 South Combee Road",
            "country_a": "USA",
            "country": "United States",
            "region": "Florida",
            "region_a": "FL",
            "county": "Polk County",
            "locality": "Crystal Lake",
            "housenumber": "440",
            "street": "South Combee Road"
          }
        ]
      }

Once you've found an address that works, update each of the fields so that it reflects the new address. Pay special attention to the text field (the actual query the test will run), the notes (which is just a helpful sentence for anyone reading the test, and of course the properties section which lists a bunch of fields for the actual address.

Keep the same format, with the postalcode in the query text but not in the properties section. IF you have to remove a field like region or region_a because the address you found doesn't have it, that's ok.

We're happy to help verify that a particular address will work for this test, but we want to make sure someone outside our team submits the actual PR. We get to do enough of them and we'd rather someone newer to the open source community gets the experience! 🏁

Add latitude/longitude coordinate requirements to test cases

Thanks to the great work of @vesameskanen some time ago, we have the ability to write tests that require the results of a query to be within a certain distance of a given point!

What do we want?

More tests that check the lat/lon of results! 🌐

When do we want it?

Whenever it makes sense. At this point, we don't have any hard and fast rules for when a test should look at the lat/lon of results. However there are definitely cases where they aren't helpful. Many of our tests are specifically for labels, for example, and adding lat/lon requirements might be overspecification.

A great case is whenever we have had a bug where a result who's name, label, etc look correct but the result is not in the right place. This test for San Francisco's centroid being on land, not in the ocean is a great example.

Some ideas

  • We have tests for places like "Union Square", which are all over the place. We currently use the city name to differentiate, but coordinates could help as well.
  • Some of our tests deal with restaurant chains like McDonalds, of which there are many all over the place. A perfect case where lat/lon requirements might be helpful.

Test Syntax

As a reminder here's the syntax of a test with a lat/lon:

  {
      "id": 1,
      "status": "fail",
      "user": "Julian",
      "in": {
        "text": "san francisco",
        "boundary.country": "USA"
      },
      "expected": {
        "distanceThresh": 1000,
        "properties": [
          {
            "region": "California",
            "name": "San Francisco"
          }
        ],
        "coordinates": [
          [ -122.431272, 37.778008 ]
        ]
      }
    },

The coordinates section in the expected section is an array of coordinates (which themselves are arrays). The coordinates are in [longitude, latitude] format with each point represented as a number (no north/south/east/west or degrees/minutes/seconds needed). The distanceThresh value is the maximum distance allowed between the expected point and the result, in meters. distanceThresh can also go at the root level of the test case at the top of the file, and then it will apply to all tests that don't override it.

[reporter] display which endpoint was used

when an endpoint other than /search is used there is no indication of that in the cli reporter which makes debugging difficult and error-prone.

eg. the following result was for "suggest/coarse"

  ✔ [4] "{"lat":40.744243,"lon":-73.990342,"input":"DiDi dump","details":false}"
  ✘ regression [5] "{"lat":40.744243,"lon":-73.990342,"input":"new york","details":false}": No matching result found.
  ✔ [6] "{"lat":40.744243,"lon":-73.990342,"input":"30 West 26th Street","details":true}"

[discussion] colours

just wondering why errors are yellow and regressions are red?

I would expect errors to be red because they are serious problems, the minor regressions such as changes in ordering of results should be yellow.

would anyone object to me changing red/yellow around?

colours

add jshint

This package was initialized without jshint; add it, and make sure that everything passes its tests.

Use an existing testing library

Right now it appears our acceptance test library is wholly home-grown, and while it works nice I wonder if we might want to switch to a widely used testing library. Mocha comes to mind first for me, but I do not have any strong preference.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Track test results between runs (builds) and alert on failures

Each execution of the test suite must store results along with API build id.
We then need a tool for keeping track of what has changed from one build to the next in each environment (dev/stage/prod). We need a clear indication of progress (working tests are incrementing) and possible regression (things that used to work now don't).

Each test case should be flagged with one of the following types:

  • working : actual == expected
  • pending : actual != expected, pending investigation / fix
  • placeholder : data is not in our data sources, or unclear if it should actually work (keep around for documentation purposes)

And here's what we need to know:

  • which tests have been added to the suite since previous execution
  • which tests used to fail and are now passing --- YAY
  • which tests used to pass and are now failing --- ALERT about this
  • which tests were changed from pending to working

Typical work flow:

  1. Begin working on an issue by selecting existing pending test cases and making them as working
  2. Write code until all working tests are passing in your local environment
    • run tests on dev and validate all working tests are passing
    • if any pending tests show up as passing mark them as working
  3. Promote code to staging
    -run tests and validate all working tests are passing
    • if any pending tests show up as passing mark them as working
    • do NOT merge to prod until all working tests are passing
  4. Promote code to prod
    • run tests and validate all working tests are passing
    • if any pending tests show up as passing, investigate and verify again on staging, this shouldn't ever happen (staging==prod)
    • do NOT merge to prod until all working tests are passing

Add distance calculator

Create distance calculator for acceptance tests that can be used to validate that a result is within x km of a point

Testing v2.0

Here's the plan:

  • Add region tag to tests/suites that will indicate which regions need to be loaded in order for those tests to pass as expected.
{
      "in": {
        "input": "search text"
      },
      "user": "sevko",
      "id": 2,
      "regions": [ "london", "new york", "berlin" ]
      ...
}
  • Allow user to run tests with an array of loaded regions and all tests where region requirements are met should be executed.
  • As before allow running the entire set of tests when planet is loaded and no regions are specified.
  • Move tests expected to fail into separate pull requests, where each one documents a bug or shortcoming of our system.
  • Move pending tests, currently in light blue, to a separate PR as well. Revisit them to fill in result details and turn them into legitimate tests.
  • Once all non-binary state tests have been moved out, update the framework to support pass/fail/warning states. Some warnings could be:
    • found but not in the expected position
    • found with N (N=1,?) field difference
    • ??? other ideas
  • Create new branch, production, and make the .travis.yaml file run all tests against production instance
  • Change .travis.yaml in master branch to create a local vagrant instance with configured regions and run acceptance tests applicable to that region only.

Fuzzy Testing

Testing the overall functionality of a geocoder is not like testing many other software projects.
While a geocoder's interface is as simple as a single function in a programming language (in our
case: send a string as input, and get GeoJSON back), the underlying complexity is a lot different.

Worse, there is lots of data involved, and at an acceptance-test level it's impossible to separate
correctness of the data and correctness of the code. Both have to work together to produce a correct
result. With a geocoder using open data we don't even have full control over our data. It can change
at any time without action on our part and changes we suggest to make things better may not stick.

So it's very clear that unit-test style tests will not be completely sufficient for testing a
geocoder. We will need something else as well.

What do we need?

What problems have to be solved to accurately and completely test a geocoder? At the very least, a
solution has to have the following properties:

Scales well to thousands of tests or more

We are literally testing the entire planet, so there are going to be a lot of tests.

Accepts that some tests will always be failing, and still provides value

A build with 10,000 tests that fails if any one tests fails will never pass, and simply getting
one bit (pass or fail) of information back from running tests will not tell us enough.

Gracefully degrades when data or code changes

Many teams hate writing tests because they end up spending too much time updating tests to pass when
their newly written or refactored code already works. We have that problem, and the problem of
previously passing tests spontaneously failing because of changing data.

Handles tests of low quality

We aren't going to write 10,000 tests ourselves. The majority of them will hopefully come from
non-technical users not involved in our project at all. Some of these tests will be bad but we won't
have time to improve them all.

What we should build?

The acceptance tests we should keep around

The first part is close to what we already have: a very closely watched set of acceptance tests. We
had about 300 of these tests until recently, when many of them were pruned. I think we should get
this down to about 50.

We should carefully craft and maintain all of these tests. Each one should very specifically test one
particular feature or bit of functionality. If two tests do almost the same thing we should get rid
of one of them. When data changes we should be responsible for manually updating the tests. The idea
is that we have so few that this isn't a huge issue.

Peter's Guide to Writing Solid Tests is certainly the starting point of our high standards for these tests.

Fuzzy testing suite

The new part we need to build is, for lack of a better name, a fuzzy testing suite. This will have
more in common with the tests for, say, a statistical machine translation test suite than a
unit-test suite.

This fuzzy testing suite will have the thousands and thousands of user-generated tests, and at any
given time a bunch of them will be failing. We will almost never update the expectations of these
tests, and as our most strongly cherished rule, we will NEVER change the input string for these
tests. If we think of a new input string that's even slightly different than one we already have,
we'll just add another test.

How to make the tests valuable

After collecting all of these tests, we'll have to do a bit of work to make tooling to even get any
value out of them.

First, instead of the main output of a test suite being simply pass/fail, the output should be given
as a score. The score for the test suite will simply be the sum of the scores from all the tests,
and for each test it will be based on how many of the expectations of the test passed. This gives
our tests a little bit more granularity. The simplest implementation would give one point for each
expectation, so a test that expected certain values for two admin names and one name field could get
three points if all three matched.

The test suite score could be reported as a total score or a percentage of the maximum possible
sore, I'm not sure which yet. Percentages seem popular for this sort of thing.

The other thing we'll want is some sort of tool set for easily viewing differences in test failures
between two builds. This would be used to see how certain code changes affect our success rate in
the tests, and occasionally could be used to update tests if we feel the need.

It sounds like this should be a diff-like utility, and if we can have our test suite output simply
be readable by diff itself, or a thin layer over diff, that saves us time building stuff and
learning a new tool.

Unsolved problems

There's a few other questions and problems we have that this plan doesn't directly solve. I'm open
to suggestions, pleas feel free to offer any thoughts!

Builds break sometimes

Sometimes something is wrong with our infrastructure and a bunch of tests are failing for a reason
unrelated to the data or code. Ideally we'd have a way to filter out these situations so they don't
cause us too much wasted effort figuring out why all our tests are broken.

Reporting pass/fail to travis, etc

While our test suite will not work in terms of a simple test/fail, lots of tools we might want to
use like bash scripts and TravisCI still do. How do we map our test output to a pass/fail when we
need to? One idea I had would be to count any test suite as a pass as long as none of the tests that
passed in the last build fail (no new regressions), but this requires that our testing tools keep
track of previous runs, which would be a bit of work.

Insight from tests changing over time

@riordan made a great, brief comment to me today about how older feedback tests and test results
could be used as snapshots of the progress of our geocoder. We could compare test results for the
same tests over time pretty easily.

Another related question is what to do as our test suite ages: a 2 year old test to find a building
that was demolished last year probably isn't useful. Maybe we assign more weight to newer tests, or
something similar.

testing nonexistence

would it be possible to test for the nonexistence of a document for a specific query?

in some cases it is handy to ensure that a record which was erroneously returned in the past is not returned again in the future.

some examples:

  • imagine the case where a specific record is removed due to profanity, could we hit the /doc endpoint to ensure that it is not found?
  • if a record was added to the wrong layer, could we test that it is now indexed on the correct layer & also that it no longer appears in the incorrect layer?
  • if a record keeps appearing in results when it shouldn't, can we ensure that after the dev work is complete that this issue will not regress?

we'll clearly never be able to source a list of all the things that shouldn't be returned for each query but in some cases copying the 1-2 test cases from the bug reports to the regression tests will ensure that the reported error doesn't come back.

Come up with a new name for the api_key config section

As specified in the README, the way to configure API keys for servers to run acceptance tests is to put them in a mapzen section of pelias.json. Obviously, this is no longer the most relevant name.

{
  "mapzen": {
    "api_key": {
      "search.mapzen.com": "search-XXXXXX"
    }
  },
  "acceptance-tests": {
    "endpoints": {
      "prod": "http://search.mapzen.com/v1/"
    }
  }
}

We should add an alternate key name (supporting the old key for backwards compatibility), that is more relevant going forward.

Connects pelias/pelias#703

Add more encoding acceptance tests

Add tests for

  • Mexico City
  • Pärnu, Estonia

Both have had encoding problems in the past for geonames results. Have been fixed with WOF import.

[bug] equalProperties recursion only tests the first child property

diff --git a/test/test.js b/test/test.js
index 740c064..0d6879b 100644
--- a/test/test.js
+++ b/test/test.js
@@ -33,6 +33,11 @@ tape( 'equalProperties() works.', function ( test ){
       expected: {a: 1},
       actual: {a: 1},
       match: true
+    },
+    {
+      expected: {a: 1},
+      actual: {a: 1, b: 2},
+      match: true
     }
   ];
  total:     19
  passing:   19
  duration:  110ms

I would suggest using an npm module for this rather than rolling your own eg:
https://www.npmjs.com/package/deep-equal

Currently failing tests

### search
  ✘ regression [2] "{"text":"brooklyn, ny"}": score 3 out of 4
  diff:
    label
      expected: Brooklyn, Kings County, NY, USA
      actual:   Brooklyn, New York, NY, USA
  ✘ regression [7] "{"text":"billerica"}": score 1 out of 2
  diff:
    label
      expected: Billerica, Middlesex County, MA, USA
      actual:   Billerica, River Pines, MA, USA
  ✘ regression [8] "{"text":"billerica, ma"}": score 1 out of 2
  diff:
    label
      expected: Billerica, Middlesex County, MA, USA
      actual:   Billerica, River Pines, MA, USA
  ✘ regression [10] "{"text":"chelsea, new york"}": score 1 out of 2
  diff:
    label
      expected: Chelsea, New York County, NY, USA
      actual:   Chelsea, London, United Kingdom
  ✘ regression [11] "{"text":"soho, new york"}": score 2 out of 4
  diff:
    label
      expected: Soho, New York County, NY, USA
      actual:   Soho, Brooklyn, NY, USA
    label
      expected: SoHo, Manhattan, NY, USA
      actual:   Soho, Brooklyn, NY, USA
  ✘ regression [1425586777012:3] "{"text":"paris"}": score 1 out of 2
  diff:
    label
      expected: Paris, France
      actual:   Paris, Paris-4E-Arrondissement, France
  ✘ regression [1425586777012:6] "{"text":"london"}": score 3 out of 6
  diff:
    label
      expected: London, Greater London, United Kingdom
      actual:   London, City of Westminster, United Kingdom
    label
      expected: London, Middlesex, Canada
      actual:   London, City of Westminster, United Kingdom
    label
      expected: London, United Kingdom
      actual:   London, City of Westminster, United Kingdom

### San Francisco
  ✘ regression [5] "{"text":"san francisco"}": score 2 out of 3
  diff:
    region
      expected: California
      actual:   Atlántida

### quattroshapes popularity
  ✘ regression [1] "{"layers":"coarse","text":"chelsea"}": score 3 out of 4
  diff:
    label
      expected: Chelsea, New York County, NY, USA
      actual:   Chelsea, London, United Kingdom
  ✘ regression [3] "{"layers":"coarse","text":"ridgewood"}": score 3 out of 4
  diff:
    label
      expected: Ridgewood, Queens County, NY, USA
      actual:   Ridgewood, Bergen County, NJ, USA
  ✘ regression [1-1] "{"layers":"coarse","text":"chelsea, ny"}": score 1 out of 2
  diff:
    label
      expected: Chelsea, New York County, NY, USA
      actual:   Chelsea, London, United Kingdom
  ✘ regression [3-1] "{"layers":"coarse","text":"ridgewood, ny"}": score 1 out of 2
  diff:
    label
      expected: Ridgewood, Queens County, NY, USA
      actual:   Ridgewood, Bergen County, NJ, USA

### Brooklyn
  ✘ regression [3] "{"text":"brooklyn","layers":"locality,localadmin","boundary.country":"USA"}": score 2 out of 3
  diff:
    region
      expected: New York
      actual:   Iowa
  ✘ regression [7] "{"text":"brooklyn","layers":"locality,localadmin"}": score 2 out of 3
  diff:
    region
      expected: New York
      actual:   Victoria

### autocomplete admin areas
  ✘ regression [2] "{"text":"new york"}": score 7 out of 8
  diff:
    label
      expected: New York, USA
      actual:   New York, Brooklyn, NY, USA
  ✘ regression [7] "{"text":"wales"}": score 1 out of 2
  diff:
    label
      expected: Wales, United Kingdom
      actual:   Powys, United Kingdom
  ✘ regression [11] "{"text":"madrid"}": score 4 out of 5
  diff:
    layer
      expected: locality
      actual:   venue

### admin lookup
  ✘ regression [17] "{"text":"ringland","layers":"neighbourhood"}": score 5 out of 6
  diff:
    county
      expected: Newport City
      actual:
  ✘ regression [18] "{"text":"california","layers":"region"}": score 8 out of 9
  diff:
    source
      expected: whosonfirst
      actual:   geonames
  ✘ regression [5] "{"point.lat":51.515049,"point.lon":-0.093229,"layers":"coarse"}": score 2 out of 3
  diff:
    region
      expected: London
      actual:
  ✘ regression [8] "{"text":"crown heights","layers":"coarse"}": score 6 out of 8
  diff:
    label
      expected: Crown Heights, Kings County, NY, USA
      actual:   Crown Heights, Poughkeepsie, NY, USA
    county
      expected: Kings County
      actual:   Dutchess County

### address parsing
  ✘ regression [3] "{"text":"450 w 37th st, new york, ny 11232"}": score 13 out of 14
  diff:
    unexpected result found
  ✘ regression [4] "{"text":"starbucks 10010"}": score 10 out of 14
  diff:
    name
      expected: Starbucks
      actual:   100 East 22nd Street
    housenumber
      expected: 304
      actual:   100
    street
      expected: Park Avenue South
      actual:   East 22nd Street
    label
      expected: Starbucks, Manhattan, NY, USA
      actual:   100 East 22nd Street, Manhattan, NY, USA

### address matching
  ✘ regression [2] "{"text":"507 hackney rd"}": score 6 out of 7
  diff:
    name
      expected: Hackney Cycles
      actual:   507 Hackney Road
  ✘ regression [3] "{"text":"49 Kay Street"}": score 2 out of 3
  diff:
    unexpected result found

Aggregate test results
Pass: 129
Fail: 24
Placeholders: 0
Regressions: 25
Took 81119ms
Test success rate 86%

Change index name

The tests are hitting
curl http://192.168.29.76:9200//search?text=Tajura%27%20wa%20an%20Nawahi%20al%20Arba%2C%20LY&sources=wof

when my index name is pelias, how can I change that?

'No result found' message

I get the error message 'No result found' when a property does not match the expected.

address type
  ✔ [1] "{"input":"102 Fleet Street","lat":51.53177,"lon":-0.06672}"
  ✔ [2] "{"input":"Shepherd and Flock","lat":51.219671,"lon":-0.779389}"
  ✘ [3] "{"input":"22 Moor Park Lane","lat":51.219671,"lon":-0.779389}": No result found.

It might be nicer to have a more descriptive error in this case such as 'Property mismatch'

clean up output, and consider own output generator

This issue consists of two closely-related parts. Firstly, the test output is excessively noisy:

> pelias-acceptance-tests@0.0.0 test /home/sevko/src/mapzen/acceptance-tests
> mocha -R spec tests



  GET /search

    1) [id:0] query: { input: 'brooklyn' } (top 3)

    2) [id:1] query: { input: 'brooklyn, ny' } (top 3)

    3) [id:2] query: { input: 'new york' } (top 3)

    4) [id:3] query: { input: 'philadelphia' } (top 3)

    5) [id:4] query: { input: 'new york, ny' } (top 3)

    6) [id:5] query: { input: '130 dean street brooklyn, ny' } (top 1)

     [id:6] query: { input: 'billerica' } (top 1) (54ms)

     [id:7] query: { input: 'billerica, ma' } (top 1) (90ms)

    7) [id:8] query: { input: '15 call street billerica, ma' } (top 1)

    8) [id:9] query: { input: 'union sq' } (top 3)

    9) [id:10] query: { input: 'union square' } (top 1)

     [id:11] query: { input: 'portland' } (top 1) (59ms)

     [id:12] query: { input: 'paris' } (top 1) (73ms)

    10) [id:13] query: { input: 'france' } (top 3)

    11) [id:14] query: { input: 'prospect park' } (top 1)

     [id:15] query: { input: 'london' } (top 1) (57ms)


  5 passing (7s)
  11 failing

  1) GET /search [id:0] query: { input: 'brooklyn' } (top 3):
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/node_modules/mocha/lib/runnable.js:159:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

  2) GET /search [id:1] query: { input: 'brooklyn, ny' } (top 3):
     Error: Expected result not in top 3
      at Object.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/tests/searchTest.js:81:19)
      at Test.assert (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/lib/test.js:221:6)
      at assert (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/lib/test.js:132:12)
      at /home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/lib/test.js:129:5
      at Test.Request.callback (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/node_modules/superagent/lib/node/index.js:746:30)
      at Test.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/node_modules/superagent/lib/node/index.js:135:10)
      at Test.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/node_modules/superagent/lib/node/index.js:938:12)
      at IncomingMessage.emit (events.js:117:20)
      at _stream_readable.js:943:16
      at process._tickCallback (node.js:419:13)

  3) GET /search [id:2] query: { input: 'new york' } (top 3):
     Error: Expected result not in top 3
      at Object.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/tests/searchTest.js:81:19)
      at Test.assert (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/lib/test.js:221:6)
      at assert (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/lib/test.js:132:12)
      at /home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/lib/test.js:129:5
      at Test.Request.callback (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/node_modules/superagent/lib/node/index.js:746:30)
      at Test.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/node_modules/superagent/lib/node/index.js:135:10)
      at Test.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/node_modules/supertest/node_modules/superagent/lib/node/index.js:938:12)
      at IncomingMessage.emit (events.js:117:20)
      at _stream_readable.js:943:16
      at process._tickCallback (node.js:419:13)

  4) GET /search [id:3] query: { input: 'philadelphia' } (top 3):
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/sevko/src/mapzen/acceptance-tests/node_modules/mocha/lib/runnable.js:159:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

/* etc */

The stack traces at the end make it difficult to view the failing tests at the top of the output, and there's some additional text in those (like the time the query took) that might not be worth displaying. I think the traces should definitely go, and while we remove them, we should consider just writing our own output generator here instead of using mocha. Could look something like this:

✘ [id 9] 'brooklyn': timeout of 2000ms exceeded
✘ [id 9] 'new york, ny': not in top 10 results
✘ [id 9] 'new york, ny': not in top 10 results
✓ [id 10] 'union sq': no `out` object specified
✓ [id 10] 'union square'

I'm suggesting that since it'll give us fine-tuned control over the output format in the long run, and would remove auto-injected mocha text.

Error: ENOENT, open '/tmp/acceptance-tests/node_modules/-e/package.json'

$ cd /tmp
$ git clone [email protected]:pelias/acceptance-tests.git
$ cd acceptance-tests/
$ npm install
$ npm test -- -e prod
npm ERR! Error: ENOENT, open '/tmp/acceptance-tests/node_modules/-e/package.json'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "test" "--" "-e" "prod"
npm ERR! cwd /tmp/acceptance-tests
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! path /tmp/acceptance-tests/node_modules/-e/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/acceptance-tests/npm-debug.log
npm ERR! not ok code 0
$ git log -1
commit d39ae19ade36afc34ce8315c79452284bfb821bb
Author: Julian Simioni <[email protected]>
Date:   Fri Jul 17 16:41:04 2015 -0400

    Upgrade travis node version to 0.12
$ node --version
v0.10.38
$ npm install pelias-fuzzy-tester@latest

Street fallback testcase

This issue is a great example of where there are little or no street numbers in our database for a query but we we have the street geometry from openstreetmap, we should return the street itself.

pelias/pelias#93

Request latency checks

Add checks for each request roundtrip time to not exceed a predetermined threshold. Be able to specify different thresholds for each environment. Report warning if average latency reaches N% of threshold. Report regression if average latency is >= threshold.

tests marked as 'fail' should not report as regressions

A recent test run failed due to 2x tests marked as "status": "fail" reported as regressions by the reporter.

GET /search
  ✘ [5] "{"input":"new york, new york"}": Result found, but not in top 3. (4)
  ✔ improvement [11] "{"input":"soho, new york"}"
  ✘ [18] "{"input":"newark airport"}": No matching result found.

admin lookup
  ✔ improvement [2] "{"input":"bronx","layers":"admin2"}"
    {
      "id": 5,
      "status": "fail",
      "issue": "https://github.com/pelias/api/issues/149",
    {
      "id": 18,
      "user": "sevko",
      "status": "fail",
      "issue": "https://github.com/pelias/api/issues/151",

Untracked file: .validate.json

After a fresh clone and an npm install a file called .validate.json appears in my working directory.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .validate.json

An in-range update of jshint is breaking the build 🚨

Version 2.9.5 of jshint just got published.

Branch Build failing 🚨
Dependency jshint
Current Version 2.9.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As jshint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes JSHint 2.9.5

2.9.5 (2017-06-22)

Bug Fixes

  • Account for hoisting of importing bindings (bd36953)
  • Add onmessage to vars.worker (540ed85)
  • Added missing "Storage" browser variable (8cfe5ad)
  • Avoid crash when peeking past end of prog (c083866)
  • Avoid false positive (44d9e0b)
  • Close synthetic scope for labeled blocks (5f0f789)
  • Fail gracefully on invalid if syntax (#3103) (8c6ac87)
  • Honor "ignore" file when linting STDIN (d4f83a4)
  • Parse for-in/of head LHS as asnmt target (da52ad9)
  • Removed warning message W041 (#3115) (376fa62)
  • Throw W033 instead of E058 when the ; after a do-while stmt is missing (6907cd4)

Features

Commits

The new version differs by 42 commits.

  • d3d84ae v2.9.5
  • 481cdca Merge branch 'W083'
  • ad7df61 [[TEST]] Update tests to reflect new W083 language
  • 5967e61 [[TEST]] Less ambiguous message for W083
  • cc215bd [[CHORE]] Update Test262
  • e6c89f0 [[CHORE]] Fix bug in test script
  • 5b957f6 Merge pull request #3126 from jugglinmike/for-lhs
  • da52ad9 [[FIX]] Parse for-in/of head LHS as asnmt target
  • b075919 [[FEAT]] Add MediaRecorder to vars.js
  • 24b8c97 Merge pull request #3066 from jugglinmike/asi-dowhile-es6-updated
  • 29c359f Merge pull request #3064 from jugglinmike/improve-yield-messages
  • c083866 [[FIX]] Avoid crash when peeking past end of prog
  • 5f0f789 [[FIX]] Close synthetic scope for labeled blocks
  • 70f9ca2 Merge remote-tracking branch 'jugglinmike/2358-improve-unused-desc'
  • bd36953 [[FIX]] Account for hoisting of importing bindings

There are 42 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

add unit tests

Unit tests weren't initially necessary due to the simplicity of the package, but, especially with the implementation of #21 , has grown rather more complex (logic-wise). Add some unit tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.