Skip to content

Commit

Permalink
tests: --config-json and /vm/config work together
Browse files Browse the repository at this point in the history
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 <acatan@amazon.com>
  • Loading branch information
acatangiu committed Jul 8, 2021
1 parent 1234f6d commit 24cc8d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/framework/vm_config.json
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 7 additions & 0 deletions tests/integration_tests/functional/test_cmd_line_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 24cc8d9

Please sign in to comment.