mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
6ed9f36125
These tests are intended to catch issues in upgrading HGE. However: * the tests are very convoluted and hard to understand, * we can only run a small subset of Python tests that don't mutate any data or metadata, and * I have never seen them fail for a legitimate reason, but I've seen a lot of flakes. While we do believe it's important to test that upgrades don't break the stored introspection, these tests don't seem to be doing that any more. I humbly request that we delete them now and either (a) figure out how to test this properly, or (b) just wait for v3, which does away with reintrospecting on server startup entirely. [NDAT-259]: https://hasurahq.atlassian.net/browse/NDAT-259?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8844 GitOrigin-RevId: 528bc632fce377b7eff2026b832bd58586ac5a0b
57 lines
2.2 KiB
Python
57 lines
2.2 KiB
Python
import pytest
|
|
import redis
|
|
|
|
from validate import check_query_f
|
|
from context import PytestConf
|
|
|
|
usefixtures = pytest.mark.usefixtures
|
|
|
|
@pytest.mark.skipif(not PytestConf.config.getoption('--redis-url'), reason="Must enable redis")
|
|
@pytest.mark.parametrize("transport", ['http'])
|
|
@usefixtures('per_class_tests_db_state')
|
|
class TestQueryCache:
|
|
def flushRedis(self):
|
|
# TODO: Move this into setup/teardown
|
|
r = redis.from_url(PytestConf.config.getoption('--redis-url'))
|
|
r.flushall()
|
|
|
|
@classmethod
|
|
def dir(cls):
|
|
return 'queries/query_cache'
|
|
|
|
def test_simple_cached_endpoint(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/simple_cached.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_metrics_one_endpoint(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_metrics_one.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_metrics_two_endpoint(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_metrics_two.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_cache_clear_endpoint(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_cache_clear.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_cache_clear_endpoint_key(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_cache_clear_key.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_cache_clear_endpoint_family(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_cache_clear_family.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_no_variables_in_query_key(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_no_variables_in_query_key.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_action_query_with_forward_client_headers_set(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_action_query_with_forward_client_headers_set.yaml', transport)
|
|
self.flushRedis()
|
|
|
|
def test_action_query_with_forward_client_header_unset(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/test_action_query_with_forward_client_headers_unset.yaml', transport)
|
|
self.flushRedis()
|