graphql-engine/server/tests-py/test_version.py
Brandon Simmons fdea752679 server/ci: rework version baking, and cache dist-newstyle in CI
UPDATE: After testing in CI it turns out that the compile time Improvement is better than expected: even though we always have to recompile the OSS lib (due to Version.hs), downstream packages like Pro and multi-tenant can still benefit from some caching and avoid full recompilation.  In the best case this takes us from 22 minutes to 13 minutes total.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4104
GitOrigin-RevId: 76cbfc157064b33856e30f4c2b2ab2366f9c6089
2022-04-05 15:59:09 +00:00

24 lines
887 B
Python

#!/usr/bin/env python3
import pytest
import re
class TestServerVersion(object):
def test_version(self, hge_ctx):
resp = hge_ctx.http.get(
hge_ctx.hge_url + '/v1/version'
)
assert resp.status_code == 200, resp
my_json = resp.json()
assert isinstance(my_json, dict), my_json
# The magic number here means we're compiling for local development and
# this test can be ignored:
if my_json['version'] != '12345':
# The tree may be dirty because we're developing tests locally while
# graphql-engine was built previously when tree was clean. If we're
# modifying graphql-engine too then both of these will be tagged dirty,
# since a rebuild would necessarily be forced:
assert my_json['version'] in (hge_ctx.version, re.sub('-dirty$', '', hge_ctx.version)), my_json