Skip to content

Commit 4ba2ad5

Browse files
test: fix component test test_configdrive.py (#5528)
* test: fix test_configdrive.py and move it to smoke test (sleep 30s as vm crashes after migration in ubuntu 20.04) * Update test/integration/smoke/test_configdrive.py Co-authored-by: dahn <daan.hoogland@gmail.com> * test: fix test_configdrive.py * Update #5528: move back to component test Co-authored-by: dahn <daan.hoogland@gmail.com>
1 parent 10bda85 commit 4ba2ad5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

test/integration/component/test_configdrive.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ def _umount_config_drive(self, ssh, mount_path):
635635
"""
636636
ssh.execute("umount -d %s" % mount_path)
637637
# Give the VM time to unlock the iso device
638-
time.sleep(2)
638+
time.sleep(0.5)
639639
# Verify umount
640640
result = ssh.execute("ls %s" % mount_path)
641641
self.assertTrue(len(result) == 0,
@@ -1089,10 +1089,8 @@ def update_and_validate_sshkeypair(self, vm, public_ip=None):
10891089

10901090
vm.details = vm_new_ssh.details
10911091

1092-
# reset SSH key also resets the password.
1093-
self._decrypt_password(vm)
1094-
1095-
vm.password_test = ConfigDriveUtils.PasswordTest(vm=vm)
1092+
# reset SSH key also removes the password (see https://github.com/apache/cloudstack/pull/4819)
1093+
vm.password_test = ConfigDriveUtils.PasswordTest(expect_pw=False)
10961094
vm.key_pair = self.keypair
10971095

10981096
if public_ip:
@@ -1119,7 +1117,7 @@ def _decrypt_password(self, vm):
11191117
cipher = PKCS1_v1_5.new(key)
11201118
new_password = cipher.decrypt(b64decode(password_), None)
11211119
if new_password:
1122-
vm.password = new_password
1120+
vm.password = new_password.decode()
11231121
else:
11241122
self.fail("Failed to decrypt new password")
11251123
except ImportError:
@@ -1511,7 +1509,6 @@ def ssh_into_VM(self, vm, public_ip, reconnect=True,
15111509
tries = 1 if negative_test else 3
15121510
private_key_file_location = keypair.private_key_file if keypair else None
15131511

1514-
@retry(tries=tries)
15151512
def retry_ssh():
15161513
ssh_client = vm.get_ssh_client(
15171514
ipaddress=public_ip.ipaddress.ipaddress,
@@ -1732,8 +1729,7 @@ def restart_Vpc(self, vpc, cleanup=False):
17321729
self.api_client.restartVPC(cmd)
17331730
self.debug("Restarted VPC with ID - %s" % vpc.id)
17341731

1735-
# was tags=["advanced", "isonw"]
1736-
@attr(tags=["TODO"], required_hardware="true")
1732+
@attr(tags=["advanced", "isonw"], required_hardware="true")
17371733
def test_configdrive_isolated_network(self):
17381734
"""Test Configdrive as provider for isolated Networks
17391735
to provide userdata and password reset functionality
@@ -2500,6 +2496,7 @@ def test_configdrive_vpc_network_verify_metadata(self):
25002496
# =====================================================================
25012497
self.debug("+++ Scenario: "
25022498
"validate updated userdata after migrate")
2499+
time.sleep(30)
25032500
host = self.migrate_VM(vm)
25042501
vm.hostname = host.name
25052502
self.then_config_drive_is_as_expected(vm, public_ip_1, metadata=True)

0 commit comments

Comments
 (0)