Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* @kesmit13
* @srinathnarayanan
* @kesmit13 @mgiannakopoulos @volodymyr-memsql @pmishchenko-ua
32 changes: 26 additions & 6 deletions singlestoredb/tests/test_fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,22 @@ def test_create_drop_workspace(self):
f'in group "A Fusion Testing {self.id}"',
)

def _wait_workspace_group_gone(self, mgr, wg_name, timeout=60, interval=2):
# WAIT ON TERMINATED polls /workspaceGroups/{id}; the LIST endpoint
# /workspaceGroups can lag briefly behind it, so poll until the listed
# record is either absent or shows terminated_at.
deadline = time.time() + timeout
while True:
wg = [x for x in mgr.workspace_groups if x.name == wg_name]
if not wg or all(x.terminated_at is not None for x in wg):
return
if time.time() >= deadline:
self.fail(
f'workspace group {wg_name!r} still active in list endpoint '
f'after {timeout}s: {wg!r}',
)
time.sleep(interval)

def test_create_drop_workspace_group(self):
mgr = s2.manage_workspaces()

Expand All @@ -428,29 +444,33 @@ def test_create_drop_workspace_group(self):
f'create workspace group "{wg_name}" '
f'in region "{reg.name}"',
)
wg = [x for x in mgr.workspace_groups if x.name == wg_name]
wg = [
x for x in mgr.workspace_groups
if x.name == wg_name and x.terminated_at is None
]
assert len(wg) == 1

# Drop it by name
self.cur.execute(
f'drop workspace group "{wg_name}" '
'wait on terminated',
)
wg = [x for x in mgr.workspace_groups if x.name == wg_name]
assert len(wg) == 0
self._wait_workspace_group_gone(mgr, wg_name)
Comment thread
cursor[bot] marked this conversation as resolved.

# Create it again
self.cur.execute(
f'create workspace group "{wg_name}" in region "{reg.name}"',
)
wg = [x for x in mgr.workspace_groups if x.name == wg_name]
wg = [
x for x in mgr.workspace_groups
if x.name == wg_name and x.terminated_at is None
]
assert len(wg) == 1

# Drop it by ID
wg_id = wg[0].id
self.cur.execute(f'drop workspace group id {wg_id} wait on terminated')
wg = [x for x in mgr.workspace_groups if x.name == wg_name]
assert len(wg) == 0
self._wait_workspace_group_gone(mgr, wg_name)

# Drop non-existent
with self.assertRaises(KeyError):
Expand Down
Loading