Skip to content

Commit

Permalink
[DPE-2904] Switching to self-hosted runners (#329)
Browse files Browse the repository at this point in the history
* Update data-platform-workflows to v11

* Switch to latest dpw

* Git add self-hosted test

* Switch to self-hosted runners for all tests

* Code review improvements

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
dragomirp and renovate[bot] authored Jan 25, 2024
1 parent e509ced commit 1b78730
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 21 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v9.3.1
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v11.0.0

unit-test:
name: Unit test charm
Expand All @@ -42,9 +42,9 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v9.3.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v11.0.0
with:
charmcraft-snap-channel: beta
cache: true

integration-test:
strategy:
Expand All @@ -59,9 +59,9 @@ jobs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v9.3.1
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v11.0.0
with:
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
cloud: lxd
juju-agent-version: ${{ matrix.juju.agent }}
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: beta
uses: canonical/data-platform-workflows/.github/workflows/[email protected]

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v9.3.1
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v11.0.0
with:
channel: 14/edge
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
secrets:
charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v9.3.1
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v11.0.0
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
15 changes: 8 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ optional = true

[tool.poetry.group.integration.dependencies]
pytest = "^7.4.4"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v11.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-operator = "^0.32.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v9.3.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v11.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v11.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "^3.3.0.0"
boto3 = "*"
tenacity = "*"
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ha_tests/test_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test: OpsTest) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ha_tests/test_restore_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
charm = None


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test: OpsTest) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ha_tests/test_self_healing.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
DB_PROCESSES = [POSTGRESQL_PROCESS, PATRONI_PROCESS]


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test: OpsTest) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ha_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
TIMEOUT = 600


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_deploy_latest(ops_test: OpsTest) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ha_tests/test_upgrade_from_stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
TIMEOUT = 600


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_deploy_stable(ops_test: OpsTest) -> None:
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/new_relations/test_new_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
INVALID_EXTRA_USER_ROLE_BLOCKING_MESSAGE = "invalid role(s) for extra user roles"


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_deploy_charms(ops_test: OpsTest, charm):
Expand Down Expand Up @@ -70,6 +71,7 @@ async def test_deploy_charms(ops_test: OpsTest, charm):
await ops_test.model.wait_for_idle(apps=APP_NAMES, status="active", timeout=3000)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_no_read_only_endpoint_in_standalone_cluster(ops_test: OpsTest):
"""Test that there is no read-only endpoint in a standalone cluster."""
Expand Down Expand Up @@ -117,6 +119,7 @@ async def test_no_read_only_endpoint_in_standalone_cluster(ops_test: OpsTest):
)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_read_only_endpoint_in_scaled_up_cluster(ops_test: OpsTest):
"""Test that there is read-only endpoint in a scaled up cluster."""
Expand All @@ -135,6 +138,7 @@ async def test_read_only_endpoint_in_scaled_up_cluster(ops_test: OpsTest):
)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_database_relation_with_charm_libraries(ops_test: OpsTest):
"""Test basic functionality of database relation interface."""
Expand Down Expand Up @@ -183,6 +187,7 @@ async def test_database_relation_with_charm_libraries(ops_test: OpsTest):
cursor.execute("DROP TABLE test;")


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_user_with_extra_roles(ops_test: OpsTest):
"""Test superuser actions and the request for more permissions."""
Expand All @@ -204,6 +209,7 @@ async def test_user_with_extra_roles(ops_test: OpsTest):
connection.close()


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_two_applications_doesnt_share_the_same_relation_data(ops_test: OpsTest):
"""Test that two different application connect to the database with different credentials."""
Expand Down Expand Up @@ -257,6 +263,7 @@ async def test_two_applications_doesnt_share_the_same_relation_data(ops_test: Op
psycopg2.connect(connection_string)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_an_application_can_connect_to_multiple_database_clusters(ops_test: OpsTest):
"""Test that an application can connect to different clusters of the same database."""
Expand Down Expand Up @@ -288,6 +295,7 @@ async def test_an_application_can_connect_to_multiple_database_clusters(ops_test
assert application_connection_string != another_application_connection_string


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_an_application_can_connect_to_multiple_aliased_database_clusters(ops_test: OpsTest):
"""Test that an application can connect to different clusters of the same database."""
Expand Down Expand Up @@ -322,6 +330,7 @@ async def test_an_application_can_connect_to_multiple_aliased_database_clusters(
assert application_connection_string != another_application_connection_string


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_an_application_can_request_multiple_databases(ops_test: OpsTest):
"""Test that an application can request additional databases using the same interface."""
Expand All @@ -343,6 +352,7 @@ async def test_an_application_can_request_multiple_databases(ops_test: OpsTest):
assert first_database_connection_string != second_database_connection_string


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_relation_data_is_updated_correctly_when_scaling(ops_test: OpsTest):
"""Test that relation data, like connection data, is updated correctly when scaling."""
Expand Down Expand Up @@ -410,6 +420,7 @@ async def test_relation_data_is_updated_correctly_when_scaling(ops_test: OpsTest
psycopg2.connect(primary_connection_string)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_relation_with_no_database_name(ops_test: OpsTest):
"""Test that a relation with no database name doesn't block the charm."""
Expand All @@ -427,6 +438,7 @@ async def test_relation_with_no_database_name(ops_test: OpsTest):
await ops_test.model.wait_for_idle(apps=APP_NAMES, status="active", raise_on_blocked=True)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_admin_role(ops_test: OpsTest):
"""Test that the admin role gives access to all the databases."""
Expand Down Expand Up @@ -512,6 +524,7 @@ async def test_admin_role(ops_test: OpsTest):
connection.close()


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_invalid_extra_user_roles(ops_test: OpsTest):
async with ops_test.fast_forward():
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ async def cloud_configs(ops_test: OpsTest, github_secrets) -> None:
bucket_object.delete()


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_none() -> None:
"""Empty test so that the suite will not fail if all tests are skippedi."""
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
UNIT_IDS = [0, 1, 2]


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
@pytest.mark.skip_if_deployed
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
async def test_mailman3_core_db(ops_test: OpsTest, charm: str) -> None:
"""Deploy Mailman3 Core to test the 'db' relation."""
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_db_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
RELATION_NAME = "db-admin"


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.skip(reason="DB Admin tests are currently broken")
async def test_landscape_scalable_bundle_db(ops_test: OpsTest, charm: str) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_password_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
APP_NAME = METADATA["name"]


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
@pytest.mark.skip_if_deployed
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
)


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_plugins(ops_test: OpsTest) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
TLS_CERTIFICATES_APP_NAME = "tls-certificates-operator"


@pytest.mark.runner(["self-hosted", "linux", "X64", "jammy", "large"])
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
@pytest.mark.skip_if_deployed
Expand Down

0 comments on commit 1b78730

Please sign in to comment.