From 4ba2ad5397956e2a29bc4be37653ff9bf06b8e84 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 30 Dec 2021 12:01:31 +0100 Subject: [PATCH] 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 * test: fix test_configdrive.py * Update #5528: move back to component test Co-authored-by: dahn --- test/integration/component/test_configdrive.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/integration/component/test_configdrive.py b/test/integration/component/test_configdrive.py index 46494f0bd65..3df175f672f 100644 --- a/test/integration/component/test_configdrive.py +++ b/test/integration/component/test_configdrive.py @@ -635,7 +635,7 @@ class ConfigDriveUtils: """ ssh.execute("umount -d %s" % mount_path) # Give the VM time to unlock the iso device - time.sleep(2) + time.sleep(0.5) # Verify umount result = ssh.execute("ls %s" % mount_path) self.assertTrue(len(result) == 0, @@ -1089,10 +1089,8 @@ class ConfigDriveUtils: vm.details = vm_new_ssh.details - # reset SSH key also resets the password. - self._decrypt_password(vm) - - vm.password_test = ConfigDriveUtils.PasswordTest(vm=vm) + # reset SSH key also removes the password (see https://github.com/apache/cloudstack/pull/4819) + vm.password_test = ConfigDriveUtils.PasswordTest(expect_pw=False) vm.key_pair = self.keypair if public_ip: @@ -1119,7 +1117,7 @@ class ConfigDriveUtils: cipher = PKCS1_v1_5.new(key) new_password = cipher.decrypt(b64decode(password_), None) if new_password: - vm.password = new_password + vm.password = new_password.decode() else: self.fail("Failed to decrypt new password") except ImportError: @@ -1511,7 +1509,6 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils): tries = 1 if negative_test else 3 private_key_file_location = keypair.private_key_file if keypair else None - @retry(tries=tries) def retry_ssh(): ssh_client = vm.get_ssh_client( ipaddress=public_ip.ipaddress.ipaddress, @@ -1732,8 +1729,7 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils): self.api_client.restartVPC(cmd) self.debug("Restarted VPC with ID - %s" % vpc.id) - # was tags=["advanced", "isonw"] - @attr(tags=["TODO"], required_hardware="true") + @attr(tags=["advanced", "isonw"], required_hardware="true") def test_configdrive_isolated_network(self): """Test Configdrive as provider for isolated Networks to provide userdata and password reset functionality @@ -2500,6 +2496,7 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils): # ===================================================================== self.debug("+++ Scenario: " "validate updated userdata after migrate") + time.sleep(30) host = self.migrate_VM(vm) vm.hostname = host.name self.then_config_drive_is_as_expected(vm, public_ip_1, metadata=True)