Skip to content

Commit

Permalink
chore: rename fixtures for clarity (#61)
Browse files Browse the repository at this point in the history
Co-authored-by: arturo-seijas <[email protected]>
  • Loading branch information
yanksyoon and arturo-seijas authored Nov 15, 2023
1 parent 2225ea1 commit 86fb692
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ async def jenkins_k8s_agents_fixture(
await model.remove_application(agent_app.name, block_until_done=True, force=True)


@pytest_asyncio.fixture(scope="function", name="app_k8s_agent_related")
async def app_k8s_agent_related_fixture(
@pytest_asyncio.fixture(scope="function", name="k8s_agent_related_app")
async def k8s_agent_related_app_fixture(
jenkins_k8s_agents: Application,
application: Application,
):
Expand Down Expand Up @@ -207,8 +207,8 @@ async def extra_jenkins_k8s_agents_fixture(
yield agent_app


@pytest_asyncio.fixture(scope="function", name="app_k8s_deprecated_agent_related")
async def app_k8s_deprecated_agent_related_fixture(
@pytest_asyncio.fixture(scope="function", name="k8s_deprecated_agent_related_app")
async def k8s_deprecated_agent_related_app_fixture(
jenkins_k8s_agents: Application,
application: Application,
):
Expand Down Expand Up @@ -269,8 +269,8 @@ async def jenkins_machine_agents_fixture(
yield app


@pytest_asyncio.fixture(scope="function", name="app_machine_agent_related")
async def app_machine_agent_related_fixture(
@pytest_asyncio.fixture(scope="function", name="machine_agent_related_app")
async def machine_agent_related_app_fixture(
jenkins_machine_agents: Application,
application: Application,
):
Expand All @@ -292,8 +292,8 @@ async def app_machine_agent_related_fixture(
yield application


@pytest_asyncio.fixture(scope="function", name="app_machine_deprecated_agent_related")
async def app_machine_deprecated_agent_related_fixture(
@pytest_asyncio.fixture(scope="function", name="machine_deprecated_agent_related_app")
async def machine_deprecated_agent_related_app_fixture(
jenkins_machine_agents: Application,
application: Application,
):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_k8s_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async def test_jenkins_k8s_agent_relation(
)


@pytest.mark.usefixtures("app_k8s_deprecated_agent_related")
@pytest.mark.usefixtures("k8s_deprecated_agent_related_app")
async def test_jenkins_k8s_deprecated_agent_relation(
jenkins_k8s_agents: Application, jenkins_client: jenkinsapi.jenkins.Jenkins
):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_machine_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def test_jenkins_machine_agent_relation(
# 1. Relate jenkins-k8s charm to the jenkins-agent charm.
model = application.model
machine_model = jenkins_machine_agents.model
# this code is similar to the app_machine_agent_related fixture but shouldn't be using the
# this code is similar to the machine_agent_related_app fixture but shouldn't be using the
# fixture since this test tests for teardown of relation as well.
# pylint: disable=duplicate-code
await model.relate(
Expand All @@ -52,7 +52,7 @@ async def test_jenkins_machine_agent_relation(
assert not any((application.name in key for key in jenkins_client.get_nodes().keys()))


@pytest.mark.usefixtures("app_machine_deprecated_agent_related")
@pytest.mark.usefixtures("machine_deprecated_agent_related_app")
async def test_jenkins_machine_deprecated_agent_relation(
jenkins_machine_agents: Application, jenkins_client: jenkinsapi.jenkins.Jenkins
):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def test_jenkins_plugins_config(
assert all(unit_web_client.client.has_plugin(plugin) for plugin in ALLOWED_PLUGINS)


@pytest.mark.usefixtures("app_k8s_agent_related")
@pytest.mark.usefixtures("k8s_agent_related_app")
async def test_git_plugin_k8s_agent(ops_test: OpsTest, unit_web_client: UnitWebClient):
"""
arrange: given a jenkins charm with git plugin installed.
Expand Down Expand Up @@ -185,7 +185,7 @@ async def test_matrix_combinations_parameter_plugin(
), f"Configuration matrix table not found, {test_page}"


@pytest.mark.usefixtures("app_k8s_agent_related")
@pytest.mark.usefixtures("k8s_agent_related_app")
async def test_postbuildscript_plugin(
ops_test: OpsTest, unit_web_client: UnitWebClient, jenkins_k8s_agents: Application
):
Expand Down Expand Up @@ -289,7 +289,7 @@ async def test_thinbackup_plugin(ops_test: OpsTest, unit_web_client: UnitWebClie
assert "FULL" in stdout, "The backup folder of format FULL-<backup-date> not found."


@pytest.mark.usefixtures("app_k8s_agent_related")
@pytest.mark.usefixtures("k8s_agent_related_app")
async def test_rebuilder_plugin(ops_test: OpsTest, unit_web_client: UnitWebClient):
"""
arrange: given a Jenkins charm with rebuilder plugin installed.
Expand Down

0 comments on commit 86fb692

Please sign in to comment.