Spawn VM with specific resource quotas
- Spawn VM and verify that provided resources is correct
on VM. Delete VM after interaction.
Change-Id: Iaba6d3379e85863b22bf06a23204377a98c1e2ac
Reviewed-on: https://review.gerrithub.io/365160
Reviewed-by: Tatyanka Leontovich <tleontovich@mirantis.com>
Reviewed-by: Dennis Dmitriev <dis.xcom@gmail.com>
Tested-by: Dennis Dmitriev <dis.xcom@gmail.com>
diff --git a/tcp_tests/tests/system/test_install_virtlet.py b/tcp_tests/tests/system/test_install_virtlet.py
index f49319d..0ccb75d 100644
--- a/tcp_tests/tests/system/test_install_virtlet.py
+++ b/tcp_tests/tests/system/test_install_virtlet.py
@@ -62,4 +62,4 @@
5. Launch Ceph one-node cluster in docker
"""
- LOG.info("*************** DONE **************")
\ No newline at end of file
+ LOG.info("*************** DONE **************")
diff --git a/tcp_tests/tests/system/test_virtlet_actions.py b/tcp_tests/tests/system/test_virtlet_actions.py
index 523aceb..4db505c 100644
--- a/tcp_tests/tests/system/test_virtlet_actions.py
+++ b/tcp_tests/tests/system/test_virtlet_actions.py
@@ -46,3 +46,35 @@
vm_name = virtlet_actions.run_vm()
virtlet_actions.wait_active_state(vm_name)
virtlet_actions.delete_vm(vm_name)
+
+ def test_vm_resource_quotas(self, underlay, virtlet_deployed, show_step,
+ virtlet_actions):
+ """Test for deploying a VM with specific quotas
+
+ Scenario:
+ 1. Prepare VM's yaml
+ 2. Start a VM
+ 3. Check that VM resources is equal to provided in yaml
+ 4. Destroy VM
+
+ """
+
+ target_cpu = 2 # Cores
+ target_memory = 256 # Size in MB
+ target_memory_kb = target_memory*1024
+ target_yaml = 'virtlet/examples/cirros-vm-exp.yaml'
+ virtlet_actions.adjust_cirros_resources(cpu=target_cpu,
+ memory=target_memory,
+ target_yaml=target_yaml)
+ vm_name = virtlet_actions.run_vm(target_yaml)
+ virtlet_actions.wait_active_state(vm_name)
+ domain_name = virtlet_actions.get_domain_name(vm_name)
+ cpu = virtlet_actions.get_vm_cpu_count(domain_name)
+ mem = virtlet_actions.get_vm_memory_count(domain_name)
+ fail_msg = '{0} is not correct memory unit for VM. Correct is {1}'.\
+ format(mem, target_memory_kb)
+ assert target_memory_kb == mem, fail_msg
+ fail_msg = '{0} is not correct cpu cores count for VM. ' \
+ 'Correct is {1}'.format(cpu, target_cpu)
+ assert target_cpu == cpu, fail_msg
+ virtlet_actions.delete_vm(target_yaml)