summaryrefslogtreecommitdiff
path: root/tests/integration_tests
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2021-10-27 09:43:34 -0500
committerGitHub <noreply@github.com>2021-10-27 08:43:34 -0600
commit1d01da5d9916d97ef463ba61a36b3f98f8911419 (patch)
tree1022c172c252082a02f89d0e54a42221dabc1851 /tests/integration_tests
parent75b26b0afbb14cf613fe3b08c8bed050dec0b874 (diff)
downloadvyos-cloud-init-1d01da5d9916d97ef463ba61a36b3f98f8911419.tar.gz
vyos-cloud-init-1d01da5d9916d97ef463ba61a36b3f98f8911419.zip
Add "install hotplug" module (SC-476) (#1069)
This commit removes automatically installing udev rules for hotplug and adds a module to install them instead. Automatically including the udev rules and checking if hotplug was enabled consumed too many resources in certain circumstances. Moving the rules to a module ensures we don't spend extra extra cycles on hotplug if hotplug functionality isn't desired. LP: #1946003
Diffstat (limited to 'tests/integration_tests')
-rw-r--r--tests/integration_tests/modules/test_hotplug.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/integration_tests/modules/test_hotplug.py b/tests/integration_tests/modules/test_hotplug.py
index 88cd8c16..f5abc86f 100644
--- a/tests/integration_tests/modules/test_hotplug.py
+++ b/tests/integration_tests/modules/test_hotplug.py
@@ -49,10 +49,13 @@ def test_hotplug_add_remove(client: IntegrationInstance):
ips_before = _get_ip_addr(client)
log = client.read_from_file('/var/log/cloud-init.log')
assert 'Exiting hotplug handler' not in log
+ assert client.execute(
+ 'test -f /etc/udev/rules.d/10-cloud-init-hook-hotplug.rules'
+ ).ok
# Add new NIC
added_ip = client.instance.add_network_interface()
- _wait_till_hotplug_complete(client, expected_runs=2)
+ _wait_till_hotplug_complete(client, expected_runs=1)
ips_after_add = _get_ip_addr(client)
new_addition = [ip for ip in ips_after_add if ip.ip4 == added_ip][0]
@@ -67,7 +70,7 @@ def test_hotplug_add_remove(client: IntegrationInstance):
# Remove new NIC
client.instance.remove_network_interface(added_ip)
- _wait_till_hotplug_complete(client, expected_runs=4)
+ _wait_till_hotplug_complete(client, expected_runs=2)
ips_after_remove = _get_ip_addr(client)
assert len(ips_after_remove) == len(ips_before)
assert added_ip not in [ip.ip4 for ip in ips_after_remove]
@@ -86,12 +89,14 @@ def test_no_hotplug_in_userdata(client: IntegrationInstance):
ips_before = _get_ip_addr(client)
log = client.read_from_file('/var/log/cloud-init.log')
assert 'Exiting hotplug handler' not in log
+ assert client.execute(
+ 'test -f /etc/udev/rules.d/10-cloud-init-hook-hotplug.rules'
+ ).failed
# Add new NIC
client.instance.add_network_interface()
- _wait_till_hotplug_complete(client)
log = client.read_from_file('/var/log/cloud-init.log')
- assert "Event Denied: scopes=['network'] EventType=hotplug" in log
+ assert 'hotplug-hook' not in log
ips_after_add = _get_ip_addr(client)
if len(ips_after_add) == len(ips_before) + 1: