Skip to content

Commit

Permalink
[DPE-4285] Fix Backup Large Deployments CI (#294)
Browse files Browse the repository at this point in the history
Two main fixes post latest large deployments updates:
* DPE-4285: fix the backups for large deployments
* Ensure the enable/disable KNN tests in `test_plugins.py` will have all its restarts resolved by the end of the test itself
  • Loading branch information
phvalguima authored May 4, 2024
1 parent 9786ffb commit 4cc224a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 37 deletions.
5 changes: 3 additions & 2 deletions tests/integration/ha/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async def test_large_deployment_build_and_deploy(
ops_test.model.deploy(
my_charm,
application_name="main",
num_units=3,
num_units=1,
series=SERIES,
config=main_orchestrator_conf,
),
Expand Down Expand Up @@ -347,11 +347,12 @@ async def test_large_deployment_build_and_deploy(
units_statuses=["active"],
wait_for_exact_units={
TLS_CERTIFICATES_APP_NAME: 1,
"main": 3,
"main": 1,
"failover": 2,
APP_NAME: 1,
},
idle_period=IDLE_PERIOD,
timeout=3600,
)

# Credentials not set yet, this will move the opensearch to blocked state
Expand Down
74 changes: 39 additions & 35 deletions tests/integration/plugins/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,45 +181,49 @@ async def test_knn_enabled_disabled(ops_test):
assert config["plugin_opensearch_knn"]["default"] is True
assert config["plugin_opensearch_knn"]["value"] is True

await ops_test.model.applications[APP_NAME].set_config({"plugin_opensearch_knn": "False"})
await wait_until(
ops_test,
apps=[APP_NAME],
apps_statuses=["active"],
units_statuses=["active"],
wait_for_exact_units={APP_NAME: 3},
timeout=3400,
idle_period=IDLE_PERIOD,
)
async with ops_test.fast_forward():
await ops_test.model.applications[APP_NAME].set_config({"plugin_opensearch_knn": "False"})
await wait_until(
ops_test,
apps=[APP_NAME],
apps_statuses=["active"],
units_statuses=["active"],
wait_for_exact_units={APP_NAME: 3},
timeout=3600,
idle_period=120,
)

await asyncio.sleep(60)
await asyncio.sleep(120)

config = await ops_test.model.applications[APP_NAME].get_config()
assert config["plugin_opensearch_knn"]["value"] is False
config = await ops_test.model.applications[APP_NAME].get_config()
assert config["plugin_opensearch_knn"]["value"] is False

await ops_test.model.applications[APP_NAME].set_config({"plugin_opensearch_knn": "True"})
await wait_until(
ops_test,
apps=[APP_NAME],
apps_statuses=["active"],
units_statuses=["active"],
wait_for_exact_units={APP_NAME: 3},
timeout=3400,
idle_period=IDLE_PERIOD,
)
await asyncio.sleep(60)
await ops_test.model.applications[APP_NAME].set_config({"plugin_opensearch_knn": "True"})
await wait_until(
ops_test,
apps=[APP_NAME],
apps_statuses=["active"],
units_statuses=["active"],
wait_for_exact_units={APP_NAME: 3},
timeout=3600,
idle_period=120,
)

config = await ops_test.model.applications[APP_NAME].get_config()
assert config["plugin_opensearch_knn"]["value"] is True
await wait_until(
ops_test,
apps=[APP_NAME],
apps_statuses=["active"],
units_statuses=["active"],
wait_for_exact_units={APP_NAME: 3},
timeout=3400,
idle_period=IDLE_PERIOD,
)
config = await ops_test.model.applications[APP_NAME].get_config()
assert config["plugin_opensearch_knn"]["value"] is True

# Wait 5 minutes to have the restart really kicking in...
await asyncio.sleep(120)

await wait_until(
ops_test,
apps=[APP_NAME],
apps_statuses=["active"],
units_statuses=["active"],
wait_for_exact_units={APP_NAME: 3},
timeout=3600,
idle_period=120,
)


@pytest.mark.group(1)
Expand Down

0 comments on commit 4cc224a

Please sign in to comment.