Skip to content

Commit

Permalink
test: Update integration tests from netplan backport (#5796)
Browse files Browse the repository at this point in the history
Along with a drive-by CURRENT_RELEASE.series fix
  • Loading branch information
TheRealFalcon authored Oct 8, 2024
1 parent e10b09b commit 4de61f3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tests/integration_tests/cmd/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from cloudinit import lifecycle
from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.releases import CURRENT_RELEASE, MANTIC
from tests.integration_tests.releases import CURRENT_RELEASE, JAMMY
from tests.integration_tests.util import (
get_feature_flag_value,
verify_clean_boot,
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_network_config_schema_validation(
"annotate": NET_V1_ANNOTATED,
},
}
if CURRENT_RELEASE >= MANTIC:
if CURRENT_RELEASE >= JAMMY:
# Support for netplan API available
content_responses[NET_CFG_V2] = {
"out": "Valid schema /root/net.yaml"
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/modules/test_apt_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.integration_tests.clouds import IntegrationCloud
from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.integration_settings import PLATFORM
from tests.integration_tests.releases import CURRENT_RELEASE, IS_UBUNTU
from tests.integration_tests.releases import CURRENT_RELEASE, IS_UBUNTU, MANTIC
from tests.integration_tests.util import (
get_feature_flag_value,
verify_clean_boot,
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_ppa_source(self, class_client: IntegrationInstance):
CURRENT_RELEASE.series
)
)
if CURRENT_RELEASE.series < "mantic":
if CURRENT_RELEASE < MANTIC:
ppa_path += ".list"
else:
ppa_path += ".sources"
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/modules/test_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from tests.integration_tests.decorators import retry
from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.integration_settings import PLATFORM
from tests.integration_tests.releases import CURRENT_RELEASE, IS_UBUNTU, MANTIC
from tests.integration_tests.releases import CURRENT_RELEASE, IS_UBUNTU, JAMMY
from tests.integration_tests.util import (
get_feature_flag_value,
get_inactive_modules,
Expand Down Expand Up @@ -95,7 +95,7 @@ def test_netplan_permissions(self, class_client: IntegrationInstance):
Test that netplan config file is generated with proper permissions
"""
log = class_client.read_from_file("/var/log/cloud-init.log")
if CURRENT_RELEASE < MANTIC:
if CURRENT_RELEASE < JAMMY:
assert (
"No netplan python module. Fallback to write"
" /etc/netplan/50-cloud-init.yaml" in log
Expand Down
9 changes: 4 additions & 5 deletions tests/integration_tests/test_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
CURRENT_RELEASE,
IS_UBUNTU,
JAMMY,
MANTIC,
NOBLE,
)
from tests.integration_tests.util import verify_clean_boot, verify_clean_log
Expand Down Expand Up @@ -67,7 +66,7 @@ def test_skip(self, client: IntegrationInstance):
client.execute(
"mv /var/log/cloud-init.log /var/log/cloud-init.log.bak"
)
if CURRENT_RELEASE < MANTIC:
if CURRENT_RELEASE < JAMMY:
assert (
"No netplan python module. Fallback to write"
" /etc/netplan/50-cloud-init.yaml" in log
Expand Down Expand Up @@ -199,7 +198,7 @@ def test_netplan_rendering(
}
with session_cloud.launch(launch_kwargs=launch_kwargs) as client:
result = client.execute("cat /etc/netplan/50-cloud-init.yaml")
if CURRENT_RELEASE < MANTIC:
if CURRENT_RELEASE < JAMMY:
assert result.stdout.startswith(EXPECTED_NETPLAN_HEADER)
else:
assert EXPECTED_NETPLAN_HEADER not in result.stdout
Expand Down Expand Up @@ -292,8 +291,8 @@ def test_invalid_network_v2_netplan(
"config_dict": config_dict,
}
) as client:
# Netplan python API only available on MANTIC and later
if CURRENT_RELEASE < MANTIC:
# Netplan python API only available on JAMMY and later
if CURRENT_RELEASE < JAMMY:
assert (
"Skipping netplan schema validation. No netplan API available"
) in client.read_from_file("/var/log/cloud-init.log")
Expand Down
6 changes: 3 additions & 3 deletions tests/integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
CURRENT_RELEASE,
FOCAL,
IS_UBUNTU,
MANTIC,
JAMMY,
)
from tests.integration_tests.util import verify_clean_boot, verify_clean_log

Expand Down Expand Up @@ -136,13 +136,13 @@ def test_clean_boot_of_upgraded_package(session_cloud: IntegrationCloud):
assert post_json["v1"]["datasource"].startswith(
"DataSourceAzure"
)
if CURRENT_RELEASE < MANTIC:
if CURRENT_RELEASE < JAMMY:
# Assert the full content is preserved including header comment
# since cloud-init writes the file directly and does not use
# netplan API to write 50-cloud-init.yaml.
assert pre_network == post_network
else:
# Mantic and later Netplan API is used and doesn't allow
# Jammy and later Netplan API is used and doesn't allow
# cloud-init to write header comments in network config
assert yaml.safe_load(pre_network) == yaml.safe_load(post_network)

Expand Down

0 comments on commit 4de61f3

Please sign in to comment.