From: Peter Krempa Date: Mon, 26 Jun 2017 17:42:06 +0000 (+0200) Subject: tests: Validate that JSON deflattening fixed nested json pseudo-protocol strings X-Git-Tag: v3.6.0-rc1~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffdf5323284b3846c949040397160415a718f6e0;p=thirdparty%2Flibvirt.git 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. --- diff --git a/tests/virjsondata/deflatten-qemu-sheepdog-in.json b/tests/virjsondata/deflatten-qemu-sheepdog-in.json new file mode 100644 index 0000000000..7c0286300f --- /dev/null +++ b/tests/virjsondata/deflatten-qemu-sheepdog-in.json @@ -0,0 +1,11 @@ +{ + "driver": "raw", + "file": { + "server.host": "10.10.10.10", + "server.port": "7000", + "tag": "", + "driver": "sheepdog", + "server.type": "inet", + "vdi": "Alice" + } +} diff --git a/tests/virjsondata/deflatten-qemu-sheepdog-out.json b/tests/virjsondata/deflatten-qemu-sheepdog-out.json new file mode 100644 index 0000000000..258b44a76c --- /dev/null +++ b/tests/virjsondata/deflatten-qemu-sheepdog-out.json @@ -0,0 +1,13 @@ +{ + "driver": "raw", + "file": { + "server": { + "host": "10.10.10.10", + "port": "7000", + "type": "inet" + }, + "tag": "", + "driver": "sheepdog", + "vdi": "Alice" + } +} diff --git a/tests/virjsontest.c b/tests/virjsontest.c index 2771cb5cd8..b3a230a02d 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -519,6 +519,7 @@ mymain(void) DO_TEST_DEFLATTEN("double-key", false); DO_TEST_DEFLATTEN("concat", true); DO_TEST_DEFLATTEN("concat-double-key", false); + DO_TEST_DEFLATTEN("qemu-sheepdog", true); return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index f34408395b..90fcf36ca1 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1575,6 +1575,16 @@ mymain(void) "\n" " \n" "\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\"}}", + "\n" + " \n" + "\n"); #endif /* WITH_YAJL */ cleanup: