Skip to content

Commit

Permalink
test: bootstrap without testmode for multitenant test
Browse files Browse the repository at this point in the history
The compiler in multitenant server always use the stdlib cache pickle
regardless of the actual stdlib in each tenant's backend. So we must
bootstrap the backends without testmode schemas, because the stdlib
cache pickle does not always have testmode schemas, e.g. in release
CIs.
  • Loading branch information
fantix committed Jan 14, 2025
1 parent 11bbdbc commit bb07283
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion edb/testbase/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2394,6 +2394,7 @@ def __init__(
extra_args: Optional[List[str]] = None,
net_worker_mode: Optional[str] = None,
password: Optional[str] = None,
testmode: bool = True,
) -> None:
self.bind_addrs = bind_addrs
self.auto_shutdown_after = auto_shutdown_after
Expand Down Expand Up @@ -2431,6 +2432,7 @@ def __init__(
self.extra_args = extra_args
self.net_worker_mode = net_worker_mode
self.password = password
self.testmode = testmode

async def wait_for_server_readiness(self, stream: asyncio.StreamReader):
while True:
Expand Down Expand Up @@ -2480,13 +2482,15 @@ async def __aenter__(self):
cmd = [
sys.executable, '-m', 'edb.server.main',
'--port', 'auto',
'--testmode',
'--emit-server-status', f'fd://{status_w.fileno()}',
'--compiler-pool-size', str(self.compiler_pool_size),
'--tls-cert-mode', str(self.tls_cert_mode),
'--jose-key-mode', 'generate',
]

if self.testmode:
cmd.extend(['--testmode'])

if self.compiler_pool_mode is not None:
cmd.extend(('--compiler-pool-mode', self.compiler_pool_mode.value))

Expand Down Expand Up @@ -2763,6 +2767,7 @@ def start_edgedb_server(
default_branch: Optional[str] = None,
net_worker_mode: Optional[str] = None,
force_new: bool = False, # True for ignoring multitenant config env
testmode: bool = True,
):
if (not devmode.is_in_dev_mode() or adjacent_to) and not runstate_dir:
if backend_dsn or adjacent_to:
Expand Down Expand Up @@ -2844,6 +2849,7 @@ def start_edgedb_server(
default_branch=default_branch,
net_worker_mode=net_worker_mode,
password=password,
testmode=testmode,
)


Expand Down
1 change: 1 addition & 0 deletions tests/test_server_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ async def _init_pg_cluster(self, path):
runstate_dir=runstate_dir,
backend_dsn=f'postgres:///?user=postgres&host={path}',
reset_auth=True,
testmode=False,
auto_shutdown_after=1,
) as sd:
connect_args = {
Expand Down

0 comments on commit bb07283

Please sign in to comment.