Skip to content

Commit

Permalink
Fix ALTER ROLE failing on nightly (#550)
Browse files Browse the repository at this point in the history
This adds some annoying logic to figure out whether admin is there

Or I could just wait until it is in all live nightlies and never care
again, but oh well.
It's probably fine if other bindings do that.
  • Loading branch information
msullivan authored Nov 27, 2024
1 parent 725d4a7 commit daf7e73
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion gel/_testbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,39 @@ def _start_cluster(*, cleanup_atexit=True):
env.pop('PYTHONPATH', None)

gel_server = env.get('EDGEDB_SERVER_BINARY', 'edgedb-server')

version_args = [gel_server, '--version']
if sys.platform == 'win32':
version_args = ['wsl', '-u', 'edgedb'] + version_args
version_res = subprocess.run(
version_args,
capture_output=True,
text=True,
)
is_gel = version_res.stdout.startswith('gel-server,')

version_line = version_res.stdout
is_gel = version_line.startswith('gel-server,')

# The default role became admin in nightly build 9024 for 6.0
if is_gel:
if '6.0-dev' in version_line:
rev = int(version_line.split('.')[2].split('+')[0])
has_admin = rev >= 9024
else:
has_admin = True
else:
has_admin = False

role = 'admin' if has_admin else 'edgedb'
args = [
gel_server,
"--temp-dir",
"--testmode",
f"--emit-server-status={status_file_unix}",
"--port=auto",
"--auto-shutdown",
"--bootstrap-command=ALTER ROLE edgedb { SET password := 'test' }",
f"--bootstrap-command=ALTER ROLE {role} {{SET password := 'test'}}",
]

help_args = [gel_server, "--help"]
Expand Down

0 comments on commit daf7e73

Please sign in to comment.