tests: Add CLI <-> API validation test for --disk changes

Check that the CLI generates the JSON data as expected.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-01-28 10:38:42 +00:00
parent 3c8cf0988d
commit b4d04bdff6

View File

@ -681,6 +681,36 @@ mod unit_tests {
}"#,
false,
),
(
vec![
"cloud-hypervisor",
"--disk",
"path=/path/to/disk/1,vhost_user=true,socket=/tmp/socket1",
"path=/path/to/disk/2",
],
r#"{
"disks": [
{"path": "/path/to/disk/1", "vhost_user":true, "vhost_socket":"/tmp/socket1"},
{"path": "/path/to/disk/2"}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--disk",
"path=/path/to/disk/1,vhost_user=true,socket=/tmp/socket1,wce=true",
"path=/path/to/disk/2",
],
r#"{
"disks": [
{"path": "/path/to/disk/1", "vhost_user":true, "vhost_socket":"/tmp/socket1", "wce":true},
{"path": "/path/to/disk/2"}
]
}"#,
true,
),
]
.iter()
.for_each(|(cli, openapi, equal)| {