torchbox / wagtail-grapple

A Wagtail app that makes building GraphQL endpoints a breeze!
https://wagtail-grapple.readthedocs.io/en/latest/
Other
152 stars 57 forks source link

Your 'site' filter value of 'b' returned multiple sites. #243

Open dopry opened 2 years ago

dopry commented 2 years ago

When running the tests for the example in main, 44d9cec3766107c82556dc3d315c1ffe2f4dc999 I am getting the error

graphql.error.located_error.GraphQLLocatedError: Your 'site' filter value of 'b' returned multiple sites. Try adding a port number (for example: 'b:80').
zerolab commented 2 years ago

The test suite runs just fine in the CI, as it does for me locally. It is unclear as to how you are running the tests. Any chance you can expand on that?

You could add some print statements around the test that is failing to get more info too

dopry commented 2 years ago

The test isn't failing. I'm just getting the traceback in the console... It's pretty straight forward setup. windows10/python3.10/bash.

python manage.py test example.tests.test_grapple.SettingsTest.test_query_single_setting_with_site_filter_clashing_port

Creating test database for alias 'default'...
System check identified no issues (0 silenced).
...........................ss..Traceback (most recent call last):
  File "C:\Users\dopry\src\torchbox\wagtail-grapple\example\venv\lib\site-packages\promise\promise.py", line 489, in _resolve_from_executor
    executor(resolve, reject)
  File "C:\Users\dopry\src\torchbox\wagtail-grapple\example\venv\lib\site-packages\promise\promise.py", line 756, in executor
    return resolve(f(*args, **kwargs))
  File "C:\Users\dopry\src\torchbox\wagtail-grapple\example\venv\lib\site-packages\graphql\execution\middleware.py", line 75, in make_it_promise
    return next(*args, **kwargs)
  File "c:\users\dopry\src\torchbox\wagtail-grapple\grapple\types\settings.py", line 62, in resolve_setting
    site = resolve_site(site_hostname) if site_hostname else None
  File "c:\users\dopry\src\torchbox\wagtail-grapple\grapple\types\settings.py", line 30, in resolve_site
    raise GraphQLError(
graphql.error.located_error.GraphQLLocatedError: Your 'site' filter value of 'b' returned multiple sites. Try adding a port number (for example: 'b:80').

..................................................................
----------------------------------------------------------------------
Ran 97 tests in 6.491s

OK (skipped=2)
Destroying test database for alias 'default'...

This is an actual error that is expected, raised, and written to the console by the django error logger. I'm not sure if the Django logger can be suppressed when the tests are running, but it would be nice... As a new contributor seeing any stack trace on the console when I'm running tests is concerning.