From 2b001de5c71799253a11e53cb5bf06262c0ddad5 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Wed, 27 Nov 2024 13:27:34 +0100 Subject: [PATCH] linter fixes --- tests/integration/tests/conftest.py | 2 ++ tests/integration/tests/test_annotations.py | 9 ++------- tests/integration/tests/test_cilium_e2e.py | 2 +- tests/integration/tests/test_cleanup.py | 2 +- tests/integration/tests/test_clustering.py | 4 +--- tests/integration/tests/test_clustering_race.py | 2 +- tests/integration/tests/test_config_propagation.py | 2 +- tests/integration/tests/test_control_plane_taints.py | 2 +- tests/integration/tests/test_dns.py | 2 +- tests/integration/tests/test_etcd.py | 2 +- tests/integration/tests/test_gateway.py | 2 +- tests/integration/tests/test_ingress.py | 2 +- tests/integration/tests/test_loadbalancer.py | 2 +- tests/integration/tests/test_metrics_server.py | 2 +- tests/integration/tests/test_network.py | 2 +- tests/integration/tests/test_networking.py | 2 +- tests/integration/tests/test_smoke.py | 2 +- tests/integration/tests/test_storage.py | 2 +- tests/integration/tests/test_strict_interfaces.py | 2 +- tests/integration/tests/test_version_upgrades.py | 2 +- 20 files changed, 22 insertions(+), 27 deletions(-) diff --git a/tests/integration/tests/conftest.py b/tests/integration/tests/conftest.py index c2959b11c..7e9db2dbd 100644 --- a/tests/integration/tests/conftest.py +++ b/tests/integration/tests/conftest.py @@ -19,6 +19,7 @@ # into the harness instances to reduce the number of downloads. PRELOADED_SNAPS = ["snapd", "core20"] + def pytest_collection_modifyitems(config, items): """ A hook to ensure all tests have at least one tag before execution. @@ -37,6 +38,7 @@ def pytest_collection_modifyitems(config, items): f"Please add at least one tag using @pytest.mark.tags." ) + def _harness_clean(h: harness.Harness): "Clean up created instances within the test harness." diff --git a/tests/integration/tests/test_annotations.py b/tests/integration/tests/test_annotations.py index e3e34d74d..30b2f734a 100644 --- a/tests/integration/tests/test_annotations.py +++ b/tests/integration/tests/test_annotations.py @@ -1,20 +1,15 @@ # # Copyright 2024 Canonical, Ltd. # -import datetime import logging -import os -import subprocess -import tempfile from typing import List import pytest -from cryptography import x509 -from cryptography.hazmat.backends import default_backend -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) + @pytest.mark.node_count(3) @pytest.mark.bootstrap_config( (config.MANIFESTS_DIR / "bootstrap-no-k8s-node-remove.yaml").read_text() diff --git a/tests/integration/tests/test_cilium_e2e.py b/tests/integration/tests/test_cilium_e2e.py index 811556185..48efec717 100644 --- a/tests/integration/tests/test_cilium_e2e.py +++ b/tests/integration/tests/test_cilium_e2e.py @@ -7,7 +7,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_cleanup.py b/tests/integration/tests/test_cleanup.py index 39206ad76..f55984a06 100644 --- a/tests/integration/tests/test_cleanup.py +++ b/tests/integration/tests/test_cleanup.py @@ -5,7 +5,7 @@ from typing import List import pytest -from test_util import harness, util, tags +from test_util import harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_clustering.py b/tests/integration/tests/test_clustering.py index 938ee0513..caf72b9b9 100644 --- a/tests/integration/tests/test_clustering.py +++ b/tests/integration/tests/test_clustering.py @@ -11,7 +11,7 @@ import pytest from cryptography import x509 from cryptography.hazmat.backends import default_backend -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) @@ -100,8 +100,6 @@ def test_worker_nodes(instances: List[harness.Instance]): ], f"only {cluster_node.id} should be left in cluster" - - @pytest.mark.node_count(3) @pytest.mark.tags(tags.NIGHTLY) def test_join_with_custom_token_name(instances: List[harness.Instance]): diff --git a/tests/integration/tests/test_clustering_race.py b/tests/integration/tests/test_clustering_race.py index 8b378c647..f29d79a2d 100644 --- a/tests/integration/tests/test_clustering_race.py +++ b/tests/integration/tests/test_clustering_race.py @@ -4,7 +4,7 @@ from typing import List import pytest -from test_util import harness, util, tags +from test_util import harness, tags, util @pytest.mark.node_count(3) diff --git a/tests/integration/tests/test_config_propagation.py b/tests/integration/tests/test_config_propagation.py index f42b1f300..e1cf7be73 100644 --- a/tests/integration/tests/test_config_propagation.py +++ b/tests/integration/tests/test_config_propagation.py @@ -5,7 +5,7 @@ from typing import List import pytest -from test_util import harness, util, tags +from test_util import harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_control_plane_taints.py b/tests/integration/tests/test_control_plane_taints.py index 520708d8d..116574df2 100644 --- a/tests/integration/tests/test_control_plane_taints.py +++ b/tests/integration/tests/test_control_plane_taints.py @@ -6,7 +6,7 @@ from typing import List import pytest -from test_util import harness, util, tags +from test_util import harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_dns.py b/tests/integration/tests/test_dns.py index 30225ee56..a507ecbbd 100644 --- a/tests/integration/tests/test_dns.py +++ b/tests/integration/tests/test_dns.py @@ -5,7 +5,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_etcd.py b/tests/integration/tests/test_etcd.py index e51f4b885..d7604d6d0 100644 --- a/tests/integration/tests/test_etcd.py +++ b/tests/integration/tests/test_etcd.py @@ -7,7 +7,7 @@ import pytest import yaml -from test_util import harness, util, tags +from test_util import harness, tags, util from test_util.etcd import EtcdCluster LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_gateway.py b/tests/integration/tests/test_gateway.py index 6cd37e649..72a332ff2 100644 --- a/tests/integration/tests/test_gateway.py +++ b/tests/integration/tests/test_gateway.py @@ -9,7 +9,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util from test_util.config import MANIFESTS_DIR LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_ingress.py b/tests/integration/tests/test_ingress.py index d2edd3eeb..1d10a8069 100644 --- a/tests/integration/tests/test_ingress.py +++ b/tests/integration/tests/test_ingress.py @@ -9,7 +9,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util from test_util.config import MANIFESTS_DIR LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_loadbalancer.py b/tests/integration/tests/test_loadbalancer.py index 944c30c35..88cefe88a 100644 --- a/tests/integration/tests/test_loadbalancer.py +++ b/tests/integration/tests/test_loadbalancer.py @@ -6,7 +6,7 @@ from typing import List import pytest -from test_util import harness, util, tags +from test_util import harness, tags, util from test_util.config import MANIFESTS_DIR LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_metrics_server.py b/tests/integration/tests/test_metrics_server.py index 5e1fd46c0..b88982160 100644 --- a/tests/integration/tests/test_metrics_server.py +++ b/tests/integration/tests/test_metrics_server.py @@ -5,7 +5,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_network.py b/tests/integration/tests/test_network.py index 033c94625..ea5fe65f1 100644 --- a/tests/integration/tests/test_network.py +++ b/tests/integration/tests/test_network.py @@ -7,7 +7,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util from test_util.config import MANIFESTS_DIR LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_networking.py b/tests/integration/tests/test_networking.py index 0dc91ea6e..1317d7458 100644 --- a/tests/integration/tests/test_networking.py +++ b/tests/integration/tests/test_networking.py @@ -6,7 +6,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_smoke.py b/tests/integration/tests/test_smoke.py index f1a992a26..7a8ba4b65 100644 --- a/tests/integration/tests/test_smoke.py +++ b/tests/integration/tests/test_smoke.py @@ -8,7 +8,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_storage.py b/tests/integration/tests/test_storage.py index 9b47792b7..028b93d88 100644 --- a/tests/integration/tests/test_storage.py +++ b/tests/integration/tests/test_storage.py @@ -8,7 +8,7 @@ from typing import List import pytest -from test_util import config, harness, util, tags +from test_util import config, harness, tags, util from test_util.config import MANIFESTS_DIR LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_strict_interfaces.py b/tests/integration/tests/test_strict_interfaces.py index ba5e3e8ca..be081422f 100644 --- a/tests/integration/tests/test_strict_interfaces.py +++ b/tests/integration/tests/test_strict_interfaces.py @@ -5,7 +5,7 @@ from typing import List import pytest -from test_util import config, harness, snap, util, tags +from test_util import config, harness, snap, tags, util LOG = logging.getLogger(__name__) diff --git a/tests/integration/tests/test_version_upgrades.py b/tests/integration/tests/test_version_upgrades.py index b30fb08fa..b4c289934 100644 --- a/tests/integration/tests/test_version_upgrades.py +++ b/tests/integration/tests/test_version_upgrades.py @@ -5,7 +5,7 @@ from typing import List import pytest -from test_util import config, harness, snap, util, tags +from test_util import config, harness, snap, tags, util LOG = logging.getLogger(__name__)