render / rpms / libvirt

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