-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from canonical/CSS-6114-dog2-scaling
CSS-6114 add on_peer_relation_changed and test for scaling
- Loading branch information
Showing
8 changed files
with
122 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ | |
"group": "groups", | ||
"membership": "groupusers", | ||
} | ||
APP_NAME = "ranger-k8s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
"""Charm scaling integration test.""" | ||
|
||
import logging | ||
|
||
import pytest | ||
from helpers import APP_NAME, get_application_url, get_memberships, scale | ||
from pytest_operator.plugin import OpsTest | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@pytest.mark.abort_on_fail | ||
@pytest.mark.usefixtures("deploy") | ||
class TestScaling: | ||
"""Integration tests for scaling Ranger charm.""" | ||
|
||
async def test_scaling_up(self, ops_test: OpsTest): | ||
"""Scale Ranger charm up to 2 units.""" | ||
await scale(ops_test, app=APP_NAME, units=2) | ||
assert len(ops_test.model.applications[APP_NAME].units) == 2 | ||
|
||
url = await get_application_url( | ||
ops_test, application=APP_NAME, port=6080 | ||
) | ||
membership = await get_memberships(ops_test, url) | ||
logger.info(f"Ranger memberships: {membership}") | ||
assert membership == ("commercial-systems", 8) | ||
|
||
async def test_scaling_down(self, ops_test: OpsTest): | ||
"""Scale Superset charm down to 1 unit.""" | ||
await scale(ops_test, app=APP_NAME, units=1) | ||
assert len(ops_test.model.applications[APP_NAME].units) == 1 | ||
|
||
url = await get_application_url( | ||
ops_test, application=APP_NAME, port=6080 | ||
) | ||
membership = await get_memberships(ops_test, url) | ||
logger.info(f"Ranger memberships: {membership}") | ||
assert membership == ("commercial-systems", 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters