mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 05:14:07 +00:00
Merge pull request #3094 from lonvia/fix-failing-bdd-tests
Add BDD tests against Python frontend to CI
This commit is contained in:
33
.github/workflows/ci-tests.yml
vendored
33
.github/workflows/ci-tests.yml
vendored
@@ -186,6 +186,39 @@ jobs:
|
|||||||
working-directory: Nominatim/test/bdd
|
working-directory: Nominatim/test/bdd
|
||||||
|
|
||||||
|
|
||||||
|
python-api-test:
|
||||||
|
needs: create-archive
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: full-source
|
||||||
|
|
||||||
|
- name: Unpack Nominatim
|
||||||
|
run: tar xf nominatim-src.tar.bz2
|
||||||
|
|
||||||
|
- uses: ./Nominatim/.github/actions/setup-postgresql
|
||||||
|
with:
|
||||||
|
postgresql-version: 15
|
||||||
|
postgis-version: 3
|
||||||
|
|
||||||
|
- uses: ./Nominatim/.github/actions/build-nominatim
|
||||||
|
with:
|
||||||
|
flavour: 'ubuntu-22'
|
||||||
|
|
||||||
|
- name: Install test prerequsites
|
||||||
|
run: sudo apt-get install -y -qq python3-behave
|
||||||
|
|
||||||
|
- name: Install Python webservers
|
||||||
|
run: pip3 install starlette asgi_lifespan httpx
|
||||||
|
|
||||||
|
- name: BDD tests (starlette)
|
||||||
|
run: |
|
||||||
|
python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DAPI_ENGINE=starlette --format=progress3
|
||||||
|
working-directory: Nominatim/test/bdd
|
||||||
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: create-archive
|
needs: create-archive
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ def extend_query_parts(queryparts: Dict[str, Any], details: Dict[str, Any],
|
|||||||
if parsed.countries:
|
if parsed.countries:
|
||||||
queryparts['countrycodes'] = ','.join(parsed.countries)
|
queryparts['countrycodes'] = ','.join(parsed.countries)
|
||||||
queryparts['exclude_place_ids'] = \
|
queryparts['exclude_place_ids'] = \
|
||||||
','.join(chain(excluded, map(str, parsed.excluded)))
|
','.join(chain(excluded, map(str, (e for e in parsed.excluded if e > 0))))
|
||||||
if parsed.viewbox:
|
if parsed.viewbox:
|
||||||
queryparts['viewbox'] = ','.join(f"{c:.7g}" for c in parsed.viewbox.coords)
|
queryparts['viewbox'] = ','.join(f"{c:.7g}" for c in parsed.viewbox.coords)
|
||||||
if parsed.bounded_viewbox:
|
if parsed.bounded_viewbox:
|
||||||
|
|||||||
@@ -160,10 +160,10 @@ Feature: Import and search of names
|
|||||||
| | 2 | |
|
| | 2 | |
|
||||||
| 1 | | 3 |
|
| 1 | | 3 |
|
||||||
Given the places
|
Given the places
|
||||||
| osm | class | type | postcode | geometry |
|
| osm | class | type | postcode | geometry |
|
||||||
| R1 | boundary | postal_code | 12345 | (1,2,3,1) |
|
| R1 | boundary | postal_code | 123-45 | (1,2,3,1) |
|
||||||
When importing
|
When importing
|
||||||
When sending search query "12345"
|
When sending search query "123-45"
|
||||||
Then results contain
|
Then results contain
|
||||||
| ID | osm |
|
| ID | osm |
|
||||||
| 0 | R1 |
|
| 0 | R1 |
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ Feature: Update of names in place objects
|
|||||||
| 4 | 3 |
|
| 4 | 3 |
|
||||||
Given the places
|
Given the places
|
||||||
| osm | class | type | postcode | geometry |
|
| osm | class | type | postcode | geometry |
|
||||||
| R1 | boundary | postal_code | 12345 | (1,2,3,4,1) |
|
| R1 | boundary | postal_code | 123-45 | (1,2,3,4,1) |
|
||||||
When importing
|
When importing
|
||||||
And sending search query "12345"
|
And sending search query "123-45"
|
||||||
Then results contain
|
Then results contain
|
||||||
| ID | osm |
|
| ID | osm |
|
||||||
| 0 | R1 |
|
| 0 | R1 |
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ def send_api_query_php(endpoint, params, context):
|
|||||||
LOG.debug("Environment:" + json.dumps(env, sort_keys=True, indent=2))
|
LOG.debug("Environment:" + json.dumps(env, sort_keys=True, indent=2))
|
||||||
|
|
||||||
if hasattr(context, 'http_headers'):
|
if hasattr(context, 'http_headers'):
|
||||||
env.update(context.http_headers)
|
for k, v in context.http_headers.items():
|
||||||
|
env['HTTP_' + k.upper().replace('-', '_')] = v
|
||||||
|
|
||||||
cmd = ['/usr/bin/env', 'php-cgi', '-f']
|
cmd = ['/usr/bin/env', 'php-cgi', '-f']
|
||||||
if context.nominatim.code_coverage_path:
|
if context.nominatim.code_coverage_path:
|
||||||
@@ -148,8 +149,7 @@ def add_http_header(context):
|
|||||||
context.http_headers = {}
|
context.http_headers = {}
|
||||||
|
|
||||||
for h in context.table.headings:
|
for h in context.table.headings:
|
||||||
envvar = 'HTTP_' + h.upper().replace('-', '_')
|
context.http_headers[h] = context.table[0][h]
|
||||||
context.http_headers[envvar] = context.table[0][h]
|
|
||||||
|
|
||||||
|
|
||||||
@when(u'sending (?P<fmt>\S+ )?search query "(?P<query>.*)"(?P<addr> with address)?')
|
@when(u'sending (?P<fmt>\S+ )?search query "(?P<query>.*)"(?P<addr> with address)?')
|
||||||
|
|||||||
Reference in New Issue
Block a user