Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update case test_cloudinit_networkconfig_isactive #427

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions os_tests/tests/test_cloud_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,15 @@ def test_cloudinit_networkconfig_isactive(self):
1. Create a VM
2. Login and check cloud-init network configure file is active
"""
# Get active interface name
lines = utils_lib.run_cmd(self,
'ip a s',
expect_ret=0,
msg="check the active interface name").split('\n')
for line in lines:
if 'state UP' in line:
active_interface = line.split()[1].strip(':')
break
# this case is workable for the default configuration
cmd = "sudo grep 'Selected renderer' /var/log/cloud-init.log"
output = utils_lib.run_cmd(self,
Expand All @@ -1001,14 +1010,14 @@ def test_cloudinit_networkconfig_isactive(self):
utils_lib.run_cmd(self,
cmd,
expect_ret=0,
expect_kw='ifcfg-eth0',
expect_kw='ifcfg-{}'.format(active_interface),
msg='check if sysconfig file is active')
# for network-manager renderer
if "Selected renderer 'network-manager' from priority list" in output :
utils_lib.run_cmd(self,
cmd,
expect_ret=0,
expect_kw='cloud-init-eth0.nmconnection',
expect_kw='cloud-init-{}.nmconnection'.format(active_interface),
msg='check if NetworkManager connection file is active')

def test_cloudinit_datasource(self):
Expand Down
Loading