Skip to content

Commit

Permalink
fix: post-rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu1nness committed Sep 23, 2024
1 parent f13cf4c commit 90ed321
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 149 deletions.
45 changes: 0 additions & 45 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
Expand Down Expand Up @@ -49,47 +48,3 @@ def chaos_mesh(ops_test: OpsTest) -> None:
yield

destroy_chaos_mesh(ops_test.model.info.name)
||||||| parent of ed9ff03 (add fixtures to conftest)
=======
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

import pytest
import pytest_asyncio
from pytest_operator.plugin import OpsTest

from .ha_tests.helpers import (
deploy_chaos_mesh,
destroy_chaos_mesh,
get_application_name,
)


@pytest_asyncio.fixture
async def continuous_writes(ops_test: OpsTest) -> None:
"""Starts continuous writes to the MongoDB cluster and clear the writes at the end."""
application_name = await get_application_name(ops_test, "application")

application_unit = ops_test.model.applications[application_name].units[0]

clear_writes_action = await application_unit.run_action("clear-continuous-writes")
await clear_writes_action.wait()

start_writes_action = await application_unit.run_action("start-continuous-writes")
await start_writes_action.wait()

yield

clear_writes_action = await application_unit.run_action("clear-continuous-writes")
await clear_writes_action.wait()


@pytest.fixture(scope="module")
def chaos_mesh(ops_test: OpsTest) -> None:
deploy_chaos_mesh(ops_test.model.info.name)

yield

destroy_chaos_mesh(ops_test.model.info.name)
>>>>>>> ed9ff03 (add fixtures to conftest)
104 changes: 0 additions & 104 deletions tests/integration/upgrades/test_revision_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
Expand Down Expand Up @@ -102,106 +101,3 @@ async def test_local_shard_reports_remote_config_server(ops_test: OpsTest) -> No
assert (
"is not up-to date with config-server." in shard_unit.workload_status_message
), "Shard does not correctly report mismatch in revision"
||||||| parent of 696c975 (add integration tests)
=======
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import pytest
from pytest_operator.plugin import OpsTest

from ..helpers import METADATA, wait_for_mongodb_units_blocked

MONGODB_K8S_CHARM = "mongodb-k8s"
SHARD_REL_NAME = "sharding"
CONFIG_SERVER_REL_NAME = "config-server"

LOCAL_SHARD_APP_NAME = "local-shard"
REMOTE_SHARD_APP_NAME = "remote-shard"
LOCAL_CONFIG_SERVER_APP_NAME = "local-config-server"
REMOTE_CONFIG_SERVER_APP_NAME = "remote-config-server"

CLUSTER_COMPONENTS = [
LOCAL_SHARD_APP_NAME,
REMOTE_SHARD_APP_NAME,
LOCAL_CONFIG_SERVER_APP_NAME,
REMOTE_CONFIG_SERVER_APP_NAME,
]


@pytest.mark.skip()
@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test: OpsTest) -> None:
my_charm = await ops_test.build_charm(".")
resources = {"mongodb-image": METADATA["resources"]["mongodb-image"]["upstream-source"]}

await ops_test.model.deploy(
MONGODB_K8S_CHARM,
application_name=REMOTE_SHARD_APP_NAME,
config={"role": "shard"},
channel="edge",
)

await ops_test.model.deploy(
MONGODB_K8S_CHARM,
application_name=REMOTE_CONFIG_SERVER_APP_NAME,
config={"role": "config-server"},
channel="edge",
)
await ops_test.model.deploy(
my_charm,
resources=resources,
config={"role": "config-server"},
application_name=LOCAL_CONFIG_SERVER_APP_NAME,
)
await ops_test.model.deploy(
my_charm,
resources=resources,
config={"role": "shard"},
application_name=LOCAL_SHARD_APP_NAME,
)

await ops_test.model.wait_for_idle(apps=CLUSTER_COMPONENTS, idle_period=20)


async def test_local_config_server_reports_remote_shard(ops_test: OpsTest) -> None:
"""Tests that the local config server reports remote shard."""
await ops_test.model.integrate(
f"{REMOTE_SHARD_APP_NAME}:{SHARD_REL_NAME}",
f"{LOCAL_CONFIG_SERVER_APP_NAME}:{CONFIG_SERVER_REL_NAME}",
)

await ops_test.model.wait_for_idle(
apps=[LOCAL_CONFIG_SERVER_APP_NAME],
status="waiting",
raise_on_blocked=False,
idle_period=20,
)

config_server_unit = ops_test.model.applications[LOCAL_CONFIG_SERVER_APP_NAME].units[0]

assert (
"Waiting for shards to upgrade/downgrade to revision"
in config_server_unit.workload_status_message
), "Config server does not correctly report mismatch in revision"


async def test_local_shard_reports_remote_config_server(ops_test: OpsTest) -> None:
"""Tests that the local shard reports remote config-server."""
await ops_test.model.integrate(
f"{LOCAL_SHARD_APP_NAME}:{SHARD_REL_NAME}",
f"{REMOTE_CONFIG_SERVER_APP_NAME}:{CONFIG_SERVER_REL_NAME}",
)

await wait_for_mongodb_units_blocked(
ops_test,
LOCAL_SHARD_APP_NAME,
timeout=300,
)

shard_unit = ops_test.model.applications[LOCAL_SHARD_APP_NAME].units[0]
assert (
"is not up-to date with config-server." in shard_unit.workload_status_message
), "Shard does not correctly report mismatch in revision"
>>>>>>> 696c975 (add integration tests)

0 comments on commit 90ed321

Please sign in to comment.