From 72becdceb44798923e91445a22fb1ba24bec2592 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 29 Sep 2021 08:48:01 +0200 Subject: [PATCH 1/4] test: fix test_configdrive.py and move it to smoke test (sleep 30s as vm crashes after migration in ubuntu 20.04) --- .../{component => smoke}/test_configdrive.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) rename test/integration/{component => smoke}/test_configdrive.py (99%) diff --git a/test/integration/component/test_configdrive.py b/test/integration/smoke/test_configdrive.py similarity index 99% rename from test/integration/component/test_configdrive.py rename to test/integration/smoke/test_configdrive.py index 46494f0bd652..d095998f74f5 100644 --- a/test/integration/component/test_configdrive.py +++ b/test/integration/smoke/test_configdrive.py @@ -60,6 +60,7 @@ import time from contextlib import contextmanager from nose.plugins.attrib import attr +from retry import retry VPC_SERVICES = 'Dhcp,StaticNat,SourceNat,NetworkACL,UserData,Dns' ISO_SERVICES = 'Dhcp,SourceNat,StaticNat,UserData,Firewall,Dns' @@ -635,7 +636,7 @@ def _umount_config_drive(self, ssh, mount_path): """ 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 +1090,8 @@ def update_and_validate_sshkeypair(self, vm, public_ip=None): 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 remove 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: @@ -1732,8 +1731,7 @@ def restart_Vpc(self, vpc, cleanup=False): 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 +2498,7 @@ def test_configdrive_vpc_network_verify_metadata(self): # ===================================================================== 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) From 14388b34c3748081e7c625162713b93f8a6e9487 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Mon, 20 Dec 2021 15:28:31 +0100 Subject: [PATCH 2/4] Update test/integration/smoke/test_configdrive.py Co-authored-by: dahn --- test/integration/smoke/test_configdrive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/smoke/test_configdrive.py b/test/integration/smoke/test_configdrive.py index d095998f74f5..70f78eaf8d9d 100644 --- a/test/integration/smoke/test_configdrive.py +++ b/test/integration/smoke/test_configdrive.py @@ -1090,7 +1090,7 @@ def update_and_validate_sshkeypair(self, vm, public_ip=None): vm.details = vm_new_ssh.details - # reset SSH key also remove the password (see https://github.com/apache/cloudstack/pull/4819) + # 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 From db7fc423c33008ad1984dabdee9486c96eecf519 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Tue, 21 Dec 2021 10:41:51 +0100 Subject: [PATCH 3/4] test: fix test_configdrive.py --- test/integration/smoke/test_configdrive.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/integration/smoke/test_configdrive.py b/test/integration/smoke/test_configdrive.py index 70f78eaf8d9d..3df175f672ff 100644 --- a/test/integration/smoke/test_configdrive.py +++ b/test/integration/smoke/test_configdrive.py @@ -60,7 +60,6 @@ import time from contextlib import contextmanager from nose.plugins.attrib import attr -from retry import retry VPC_SERVICES = 'Dhcp,StaticNat,SourceNat,NetworkACL,UserData,Dns' ISO_SERVICES = 'Dhcp,SourceNat,StaticNat,UserData,Firewall,Dns' @@ -1118,7 +1117,7 @@ def _decrypt_password(self, vm): 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: @@ -1510,7 +1509,6 @@ def ssh_into_VM(self, vm, public_ip, reconnect=True, 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, From f1da9581469ca65d09cc35078fdffe0830fe617a Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 24 Dec 2021 08:43:02 +0100 Subject: [PATCH 4/4] Update #5528: move back to component test --- test/integration/{smoke => component}/test_configdrive.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/integration/{smoke => component}/test_configdrive.py (100%) diff --git a/test/integration/smoke/test_configdrive.py b/test/integration/component/test_configdrive.py similarity index 100% rename from test/integration/smoke/test_configdrive.py rename to test/integration/component/test_configdrive.py