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>
This commit is contained in:
Wei Zhou 2021-12-30 12:01:31 +01:00 committed by GitHub
parent 10bda8549b
commit 4ba2ad5397
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)