server/tests-py: Remove test_startup_db_calls.py.

This removes the *test_startup_db_calls.py* tests. These tests are looking for a specific regression on resolving sources multiple times on startup. I have never seen them fail and I'm not convinced the tests are worthwhile.

This is compounded by the roundabout way in which we verify that we resolve the sources; we do it by inspecting the logs. This is a real pain to port to the fixture-based method of spinning HGE, and I don't believe it's worth the effort; I'd rather just delete it.

[NDAT-540]: https://hasurahq.atlassian.net/browse/NDAT-540?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8813
GitOrigin-RevId: 0a313e7998fa034fa96aaa10924d9d11dd1856f4
This commit is contained in:
Samir Talwar 2023-04-19 17:28:50 +02:00 committed by hasura-bot
parent 2635ed46bd
commit 832fac9c69
2 changed files with 1 additions and 48 deletions

View File

@ -45,7 +45,7 @@
# remote-schema-https
# query-caching
# query-logs
startup-db-calls
# startup-db-calls
# webhook-request-context
# post-webhook
# get-webhook

View File

@ -1,47 +0,0 @@
#!/usr/bin/env python3
import json
import os
import time
import pytest
from context import PytestConf
if not PytestConf.config.getoption("--test-startup-db-calls"):
pytest.skip("--test-startup-db-calls missing, skipping tests", allow_module_level=True)
def parse_logs():
# parse the log file into a json list
log_file = os.getenv('LOGGING_TEST_LOGFILE_PATH', None)
if not log_file:
print('Could not determine log file path to test logging!')
assert False
loglines = []
with open(log_file, 'r') as f:
loglines = f.readlines()
logs = list(map(lambda x: json.loads(x.strip()), loglines))
assert len(logs) > 0
return logs
class TestStartupDBLogging():
@pytest.fixture(autouse=True)
def transact(self):
try:
# gather and parse the logs
self.logs = parse_logs()
# sometimes the log might take time to buffer
time.sleep(2)
yield
except:
assert False
def test_startup_db_calls_logs(self):
def _get_source_resolve(x):
return x['type'] == 'startup' and \
'kind' in x['detail'] and \
x['detail']['kind'] == 'resolve_source'
source_resolve_logs = list(filter(_get_source_resolve, self.logs))
print(source_resolve_logs)
assert len(source_resolve_logs) == 1