render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From f2367a6085be46fa0c3e948d0da1277f38bf2fa8 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <f2367a6085be46fa0c3e948d0da1277f38bf2fa8@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Fri, 17 Jan 2020 13:16:58 +0100
a41c76
Subject: [PATCH] tests: virstorage: Add tests for NBD URI style syntax over
a41c76
 UNIX
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Add few test cases for nbd+unix style URIs with few corner cases.
a41c76
a41c76
The NBD URI syntax is documented at
a41c76
https://github.com/NetworkBlockDevice/nbd/blob/master/doc/uri.md
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 2775aada167fad5a508b16a8cadac1fca489c7be)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1791614
a41c76
Message-Id: <5c316356be1b5aca0cc2858925833e6316de10f8.1579263320.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
a41c76
---
a41c76
 tests/virstoragetest.c | 20 ++++++++++++++++++++
a41c76
 1 file changed, 20 insertions(+)
a41c76
a41c76
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
a41c76
index 370e19252b..4341c04b1e 100644
a41c76
--- a/tests/virstoragetest.c
a41c76
+++ b/tests/virstoragetest.c
a41c76
@@ -1274,6 +1274,26 @@ mymain(void)
a41c76
                        "<source protocol='nbd' name='exportname'>\n"
a41c76
                        "  <host name='example.org' port='1234'/>\n"
a41c76
                        "</source>\n");
a41c76
+    TEST_BACKING_PARSE("nbd+unix://?socket=/tmp/sock",
a41c76
+                       "<source protocol='nbd'>\n"
a41c76
+                       "  <host transport='unix' socket='/tmp/sock'/>\n"
a41c76
+                       "</source>\n");
a41c76
+    TEST_BACKING_PARSE("nbd+unix:///?socket=/tmp/sock",
a41c76
+                       "<source protocol='nbd'>\n"
a41c76
+                       "  <host transport='unix' socket='/tmp/sock'/>\n"
a41c76
+                       "</source>\n");
a41c76
+    TEST_BACKING_PARSE("nbd+unix:////?socket=/tmp/sock",
a41c76
+                       "<source protocol='nbd' name='/'>\n"
a41c76
+                       "  <host transport='unix' socket='/tmp/sock'/>\n"
a41c76
+                       "</source>\n");
a41c76
+    TEST_BACKING_PARSE("nbd+unix:///exp?socket=/tmp/sock",
a41c76
+                       "<source protocol='nbd' name='exp'>\n"
a41c76
+                       "  <host transport='unix' socket='/tmp/sock'/>\n"
a41c76
+                       "</source>\n");
a41c76
+    TEST_BACKING_PARSE("nbd+unix:////exp?socket=/tmp/sock",
a41c76
+                       "<source protocol='nbd' name='/exp'>\n"
a41c76
+                       "  <host transport='unix' socket='/tmp/sock'/>\n"
a41c76
+                       "</source>\n");
a41c76
     TEST_BACKING_PARSE_FULL("iscsi://testuser:testpass@example.org:1234/exportname",
a41c76
                             "<source protocol='iscsi' name='exportname'>\n"
a41c76
                             "  <host name='example.org' port='1234'/>\n"
a41c76
-- 
a41c76
2.25.0
a41c76