Browse Source

fuzzy_tester: add acceptance test runner

pull/3/head
Peter Johnson 6 years ago
parent
commit
0c1a7e3682
  1. 11
      README.md
  2. 7
      cmd/test.sh
  3. 1
      projects/los-angeles-metro/README.md
  4. 8
      projects/los-angeles-metro/docker-compose.yml
  5. 5
      projects/los-angeles-metro/pelias.json
  6. 49
      projects/los-angeles-metro/test_cases/search_venue.json
  7. 1
      projects/portland-metro/README.md
  8. 8
      projects/portland-metro/docker-compose.yml
  9. 5
      projects/portland-metro/pelias.json
  10. 8057
      projects/portland-metro/test_cases/search_address.json
  11. 49
      projects/portland-metro/test_cases/search_venue.json

11
README.md

@ -226,6 +226,14 @@ pelias system env display environment variables
pelias system update update the pelias command by pulling the latest version
```
### Test command
The test command runs the [fuzzy-tester](https://github.com/pelias/fuzzy-tester) tests against any test cases in your project.
```bash
test run run fuzzy-tester test cases
```
## Generic build workflow
The following shell script can be used to automate a build:
@ -261,6 +269,9 @@ pelias download all
pelias prepare all
pelias import all
pelias compose up
# optionally run tests
pelias test run
```
## View status of running containers

7
cmd/test.sh

@ -0,0 +1,7 @@
#!/bin/bash
set -e;
# run acceptance tests
function test_fuzzy(){ compose_run 'fuzzy-tester' -e 'docker' $@; }
register 'test' 'run' 'run fuzzy-tester test cases' test_fuzzy

1
projects/los-angeles-metro/README.md

@ -24,6 +24,7 @@ pelias download all
pelias prepare all
pelias import all
pelias compose up
pelias test run
```
# Make an Example Query

8
projects/los-angeles-metro/docker-compose.yml

@ -112,3 +112,11 @@ services:
soft: 65536
hard: 65536
cap_add: [ "IPC_LOCK" ]
fuzzy-tester:
image: pelias/fuzzy-tester:master
container_name: pelias_fuzzy_tester
restart: "no"
command: "--help"
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"

5
projects/los-angeles-metro/pelias.json

@ -17,6 +17,11 @@
}
}
},
"acceptance-tests": {
"endpoints": {
"docker": "http://api:4000/v1/"
}
},
"api": {
"textAnalyzer": "libpostal",
"services": {

49
projects/los-angeles-metro/test_cases/search_venue.json

@ -0,0 +1,49 @@
{
"name": "/v1/search venues",
"priorityThresh": 1,
"endpoint": "search",
"tests": [
{
"id": 1,
"status": "pass",
"notes": "los angeles international airport should come up for LAX",
"in": {
"text": "lax"
},
"expected": {
"properties": [
{
"layer": "venue",
"name": "Los Angeles International Airport",
"country_a": "USA",
"country": "United States",
"region": "California",
"region_a": "CA",
"locality": "Los Angeles"
}
]
}
},
{
"id": 2,
"status": "pass",
"notes": "los angeles international airport should come up for LAX",
"in": {
"text": "lax airport"
},
"expected": {
"properties": [
{
"layer": "venue",
"name": "Los Angeles International Airport",
"country_a": "USA",
"country": "United States",
"region": "California",
"region_a": "CA",
"locality": "Los Angeles"
}
]
}
}
]
}

1
projects/portland-metro/README.md

@ -26,6 +26,7 @@ pelias download all
pelias prepare all
pelias import all
pelias compose up
pelias test run
```
# Make an Example Query

8
projects/portland-metro/docker-compose.yml

@ -112,3 +112,11 @@ services:
soft: 65536
hard: 65536
cap_add: [ "IPC_LOCK" ]
fuzzy-tester:
image: pelias/fuzzy-tester:master
container_name: pelias_fuzzy_tester
restart: "no"
command: "--help"
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"

5
projects/portland-metro/pelias.json

@ -17,6 +17,11 @@
}
}
},
"acceptance-tests": {
"endpoints": {
"docker": "http://api:4000/v1/"
}
},
"api": {
"textAnalyzer": "libpostal",
"services": {

8057
projects/portland-metro/test_cases/search_address.json

File diff suppressed because it is too large Load Diff

49
projects/portland-metro/test_cases/search_venue.json

@ -0,0 +1,49 @@
{
"name": "/v1/search venues",
"priorityThresh": 1,
"endpoint": "search",
"tests": [
{
"id": 1,
"status": "pass",
"notes": "portland international should come up for PDX",
"in": {
"text": "pdx"
},
"expected": {
"properties": [
{
"layer": "venue",
"name": "Portland International Airport",
"country_a": "USA",
"country": "United States",
"region": "Oregon",
"region_a": "OR",
"locality": "Portland"
}
]
}
},
{
"id": 2,
"status": "pass",
"notes": "portland international should come up for PDX",
"in": {
"text": "pdx airport"
},
"expected": {
"properties": [
{
"layer": "venue",
"name": "Portland International Airport",
"country_a": "USA",
"country": "United States",
"region": "Oregon",
"region_a": "OR",
"locality": "Portland"
}
]
}
}
]
}
Loading…
Cancel
Save