Skip to content

Commit

Permalink
Merge pull request #427 from zhaohuijuan/dev
Browse files Browse the repository at this point in the history
Update case test_cloudinit_networkconfig_isactive
  • Loading branch information
zhaohuijuan authored Aug 28, 2024
2 parents f5d33ab + 4085f5b commit f814ec8
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit f814ec8

Please sign in to comment.