mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
tests: Validate that JSON deflattening fixed nested json pseudo-protocol strings
Sheepdog and possibly others use nested objects for network server and thus could be specified in a way that libvirt would not parse. Validates that https://bugzilla.redhat.com/show_bug.cgi?id=1464821 is fixed properly.
This commit is contained in:
parent
6d7cdec63d
commit
ffdf532328
11
tests/virjsondata/deflatten-qemu-sheepdog-in.json
Normal file
11
tests/virjsondata/deflatten-qemu-sheepdog-in.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"driver": "raw",
|
||||||
|
"file": {
|
||||||
|
"server.host": "10.10.10.10",
|
||||||
|
"server.port": "7000",
|
||||||
|
"tag": "",
|
||||||
|
"driver": "sheepdog",
|
||||||
|
"server.type": "inet",
|
||||||
|
"vdi": "Alice"
|
||||||
|
}
|
||||||
|
}
|
13
tests/virjsondata/deflatten-qemu-sheepdog-out.json
Normal file
13
tests/virjsondata/deflatten-qemu-sheepdog-out.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"driver": "raw",
|
||||||
|
"file": {
|
||||||
|
"server": {
|
||||||
|
"host": "10.10.10.10",
|
||||||
|
"port": "7000",
|
||||||
|
"type": "inet"
|
||||||
|
},
|
||||||
|
"tag": "",
|
||||||
|
"driver": "sheepdog",
|
||||||
|
"vdi": "Alice"
|
||||||
|
}
|
||||||
|
}
|
@ -519,6 +519,7 @@ mymain(void)
|
|||||||
DO_TEST_DEFLATTEN("double-key", false);
|
DO_TEST_DEFLATTEN("double-key", false);
|
||||||
DO_TEST_DEFLATTEN("concat", true);
|
DO_TEST_DEFLATTEN("concat", true);
|
||||||
DO_TEST_DEFLATTEN("concat-double-key", false);
|
DO_TEST_DEFLATTEN("concat-double-key", false);
|
||||||
|
DO_TEST_DEFLATTEN("qemu-sheepdog", true);
|
||||||
|
|
||||||
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -1575,6 +1575,16 @@ mymain(void)
|
|||||||
"<source protocol='sheepdog' name='test'>\n"
|
"<source protocol='sheepdog' name='test'>\n"
|
||||||
" <host name='example.com' port='321'/>\n"
|
" <host name='example.com' port='321'/>\n"
|
||||||
"</source>\n");
|
"</source>\n");
|
||||||
|
TEST_BACKING_PARSE("json:{\"driver\": \"raw\","
|
||||||
|
"\"file\": {\"server.host\": \"10.10.10.10\","
|
||||||
|
"\"server.port\": \"7000\","
|
||||||
|
"\"tag\": \"\","
|
||||||
|
"\"driver\": \"sheepdog\","
|
||||||
|
"\"server.type\": \"inet\","
|
||||||
|
"\"vdi\": \"Alice\"}}",
|
||||||
|
"<source protocol='sheepdog' name='Alice'>\n"
|
||||||
|
" <host name='10.10.10.10' port='7000'/>\n"
|
||||||
|
"</source>\n");
|
||||||
#endif /* WITH_YAJL */
|
#endif /* WITH_YAJL */
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
Reference in New Issue
Block a user