Fix missing import of edbserver (#6509)

This is imported locally to avoid a circular import
This commit is contained in:
Fantix King 2023-11-24 01:41:43 +09:00 committed by GitHub
parent c7e10203ad
commit c1d615f1df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -1028,6 +1028,8 @@ class Tenant(ha_base.ClusterProtocol):
self._jwt_sub_allowlist_file.read_text().splitlines(),
)
except Exception as e:
from . import server as edbserver
raise edbserver.StartupError(
f"cannot load JWT sub allowlist: {e}"
) from e
@ -1042,6 +1044,8 @@ class Tenant(ha_base.ClusterProtocol):
self._jwt_revocation_list_file.read_text().splitlines(),
)
except Exception as e:
from . import server as edbserver
raise edbserver.StartupError(
f"cannot load JWT revocation list: {e}"
) from e

View file

@ -31,6 +31,7 @@ import edgedb
from edb.common import secretkey
from edb.server import args
from edb.server import cluster as edbcluster
from edb.schema import defines as s_def
from edb.testbase import server as tb
@ -472,6 +473,16 @@ class TestServerAuth(tb.ConnectedTestCase):
subject = "test"
key_id = "foobar"
with self.assertRaisesRegex(
edbcluster.ClusterError, "cannot load JWT"
):
async with tb.start_edgedb_server(
jws_key_file=jwk_file,
jwt_sub_allowlist_file='/tmp/non_existant',
jwt_revocation_list_file='/tmp/non_existant',
):
pass
async with tb.start_edgedb_server(
jws_key_file=jwk_file,
jwt_sub_allowlist_file=allowlist_file,