mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-21 14:31:55 +03:00
b274a2d240
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com> Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com> Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com> Co-authored-by: hasura-bot <30118761+hasura-bot@users.noreply.github.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com> Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com> Co-authored-by: Rishichandra Wawhal <27274869+wawhal@users.noreply.github.com> Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com> Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com> GitOrigin-RevId: c9a8be3cb607f7767e9d6791717106adf123e3a8
61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
import pytest
|
|
import os
|
|
import redis
|
|
|
|
from validate import check_query_f, check_query, get_conf_f
|
|
from context import PytestConf
|
|
|
|
# Mark that all tests in this module can be run as server upgrade tests
|
|
pytestmark = pytest.mark.allow_server_upgrade_test
|
|
|
|
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()
|