summaryrefslogtreecommitdiff
path: root/tests/integration_tests
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2022-01-15 11:55:23 -0600
committerGitHub <noreply@github.com>2022-01-15 10:55:23 -0700
commitb306633fd17e5ba0173ad3c41add59cb11884757 (patch)
tree51e97864d4ab610ac527b33a13fbca753664690b /tests/integration_tests
parent73b1bb1f7665216053494717de27d7daf445d751 (diff)
downloadvyos-cloud-init-b306633fd17e5ba0173ad3c41add59cb11884757.tar.gz
vyos-cloud-init-b306633fd17e5ba0173ad3c41add59cb11884757.zip
Ensure system_cfg read before ds net config on Oracle (SC-720) (#1174)
In 2c52e6e88b19f5db8d55eb7280ee27703e05d75f, the order of reading network config was changed for Oracle due to initramfs needing to take lower precedence than the datasource. However, this also bumped system_cfg to a lower precedence than ds, which means that any network configuration specified in /etc/cloud will not be applied. system_cfg should instead be moved above ds so network configuration in /etc/cloud takes precedence. LP: #1956788
Diffstat (limited to 'tests/integration_tests')
-rw-r--r--tests/integration_tests/network/test_net_config_load.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/integration_tests/network/test_net_config_load.py b/tests/integration_tests/network/test_net_config_load.py
new file mode 100644
index 00000000..a6863b63
--- /dev/null
+++ b/tests/integration_tests/network/test_net_config_load.py
@@ -0,0 +1,27 @@
+"""Test loading the network config"""
+import pytest
+
+from tests.integration_tests.instances import IntegrationInstance
+
+
+def _customize_envionment(client: IntegrationInstance):
+ # Insert our "disable_network_config" file here
+ client.write_to_file(
+ "/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg",
+ "network: {config: disabled}\n",
+ )
+ client.execute("cloud-init clean --logs")
+ client.restart()
+
+
+def test_network_disabled_via_etc_cloud(client: IntegrationInstance):
+ """Test that network can be disabled via config file in /etc/cloud"""
+ if client.settings.CLOUD_INIT_SOURCE == "IN_PLACE":
+ pytest.skip(
+ "IN_PLACE not supported as we mount /etc/cloud contents into the "
+ "container"
+ )
+ _customize_envionment(client)
+
+ log = client.read_from_file("/var/log/cloud-init.log")
+ assert "network config is disabled by system_cfg" in log