From 24cc8d9b689d31de95ae33eca16273383f01b79e Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Mon, 5 Jul 2021 16:18:04 +0300 Subject: [PATCH] tests: --config-json and /vm/config work together Commit modifies 'framework/vm_config.json' to be explicitly complete. Validates that exported config and imported configs are compatible/interchangeable by configuring and booting vm from config file, then verifying that exported config is equal to config file. Signed-off-by: Adrian Catangiu --- tests/framework/vm_config.json | 19 +++++++++++++++---- .../functional/test_cmd_line_start.py | 7 +++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/framework/vm_config.json b/tests/framework/vm_config.json index ae0cdebd340..891f0fb11be 100644 --- a/tests/framework/vm_config.json +++ b/tests/framework/vm_config.json @@ -1,19 +1,30 @@ { "boot-source": { "kernel_image_path": "vmlinux.bin", - "boot_args": "console=ttyS0 reboot=k panic=1 pci=off" + "boot_args": "console=ttyS0 reboot=k panic=1 pci=off", + "initrd_path": null }, "drives": [ { "drive_id": "rootfs", "path_on_host": "xenial.rootfs.ext4", "is_root_device": true, - "is_read_only": false + "partuuid": null, + "is_read_only": false, + "cache_type": "Unsafe", + "rate_limiter": null } ], "machine-config": { "vcpu_count": 2, "mem_size_mib": 1024, - "ht_enabled": false - } + "ht_enabled": false, + "track_dirty_pages": false + }, + "balloon": null, + "network-interfaces": [], + "vsock": null, + "logger": null, + "metrics": null, + "mmds-config": null } \ No newline at end of file diff --git a/tests/integration_tests/functional/test_cmd_line_start.py b/tests/integration_tests/functional/test_cmd_line_start.py index 4f5af15fba4..2b9da251615 100644 --- a/tests/integration_tests/functional/test_cmd_line_start.py +++ b/tests/integration_tests/functional/test_cmd_line_start.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 """Tests microvm start with configuration file as command line parameter.""" +import json import os import re @@ -54,6 +55,12 @@ def test_config_start_with_api(test_microvm_with_ssh, vm_config_file): assert test_microvm.api_session.is_status_ok(response.status_code) assert test_microvm.state == "Running" + # Validate full vm configuration. + response = test_microvm.full_cfg.get() + assert test_microvm.api_session.is_status_ok(response.status_code) + with open(vm_config_file) as json_file: + assert response.json() == json.load(json_file) + @pytest.mark.parametrize( "vm_config_file",