Skip to content

Commit

Permalink
Changes on PR request
Browse files Browse the repository at this point in the history
  • Loading branch information
juditnovak committed May 27, 2024
1 parent 3430095 commit 9a30354
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
23 changes: 8 additions & 15 deletions tests/integration/test_rolling_upgrade_from_specific_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ async def test_deploy_charms(ops_test: OpsTest, application_charm, database_char
@pytest.mark.parametrize("component", ["app", "unit"])
async def test_peer_relation(component, ops_test: OpsTest):
"""Peer relation safe across upgrades."""
await upgrade_to_new_version(ops_test, DATABASE_APP_NAME)
await downgrade_to_old_version(ops_test, DATABASE_APP_NAME)

# Setting and verifying two fields (one that should be a secret, one plain text)
Expand Down Expand Up @@ -211,9 +210,9 @@ async def test_unbalanced_versions_req_old_vs_prov_new(
await ops_test.model.wait_for_idle(apps=APP_NAMES, status="active")

# Username
leader_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_name = f"{APPLICATION_APP_NAME}/{leader_id}"
action = await ops_test.model.units.get(leader_name).run_action(
leader_app_id = await get_leader_id(ops_test, APPLICATION_APP_NAME)
leader_app_name = f"{APPLICATION_APP_NAME}/{leader_app_id}"
action = await ops_test.model.units.get(leader_app_name).run_action(
"get-relation-field",
**{"relation_id": pytest.first_database_relation.id, "field": "username"},
)
Expand All @@ -223,9 +222,7 @@ async def test_unbalanced_versions_req_old_vs_prov_new(
username = action.results.get("value")

# Password
leader_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_name = f"{APPLICATION_APP_NAME}/{leader_id}"
action = await ops_test.model.units.get(leader_name).run_action(
action = await ops_test.model.units.get(leader_app_name).run_action(
"get-relation-field",
**{"relation_id": pytest.first_database_relation.id, "field": "password"},
)
Expand All @@ -245,8 +242,6 @@ async def test_unbalanced_versions_req_old_vs_prov_new(
assert action.results.get("value") == username

# Password is correct
leader_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_name = f"{DATABASE_APP_NAME}/{leader_id}"
action = await ops_test.model.units.get(leader_name).run_action(
"get-relation-self-side-field",
**{"relation_id": pytest.first_database_relation.id, "field": "password"},
Expand All @@ -261,7 +256,7 @@ async def test_rolling_upgrade_requires_old_vs_provides_new(ops_test: OpsTest):
await upgrade_to_new_version(ops_test, APPLICATION_APP_NAME)

# Application charm leader
leader_app_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_app_id = await get_leader_id(ops_test, APPLICATION_APP_NAME)
leader_app_name = f"{APPLICATION_APP_NAME}/{leader_app_id}"

# DB leader
Expand Down Expand Up @@ -316,7 +311,7 @@ async def test_rolling_upgrade_requires_old_vs_provides_new_upgrade_new_secret(
):
"""After Requires upgrade new secrets are possible to define."""
# Application charm leader
leader_app_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_app_id = await get_leader_id(ops_test, APPLICATION_APP_NAME)
leader_app_name = f"{APPLICATION_APP_NAME}/{leader_app_id}"

# DB leader
Expand Down Expand Up @@ -409,8 +404,6 @@ async def test_unbalanced_versions_req_new_vs_prov_old(
assert action.results.get("value")

# Password exists
leader_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_name = f"{DATABASE_APP_NAME}/{leader_id}"
action = await ops_test.model.units.get(leader_name).run_action(
"get-relation-self-side-field",
**{"relation_id": pytest.second_database_relation.id, "field": "password"},
Expand All @@ -427,7 +420,7 @@ async def test_rolling_upgrade_requires_new_vs_provides_old(
await upgrade_to_new_version(ops_test, DATABASE_APP_NAME)

# Application charm leader
leader_app_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_app_id = await get_leader_id(ops_test, APPLICATION_APP_NAME)
leader_app_name = f"{APPLICATION_APP_NAME}/{leader_app_id}"

# DB leader
Expand Down Expand Up @@ -482,7 +475,7 @@ async def test_rolling_upgrade_requires_new_vs_provides_old_upgrade_new_secret(
):
"""After Provider upgrade, we can safely define new secrets."""
# Application charm leader
leader_app_id = await get_leader_id(ops_test, DATABASE_APP_NAME)
leader_app_id = await get_leader_id(ops_test, APPLICATION_APP_NAME)
leader_app_name = f"{APPLICATION_APP_NAME}/{leader_app_id}"

# DB leader
Expand Down
5 changes: 0 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ pass_env =
MODEL_SETTINGS
LIBJUJU_VERSION_SPECIFIER
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION
allowlist_externals =
cp
grep
echo
bash

[testenv:format]
description = Apply coding style standards to code
Expand Down

0 comments on commit 9a30354

Please sign in to comment.