libvirt/SOURCES/libvirt-tests-virstorage-Add-tests-for-NBD-URI-style-syntax-over-UNIX.patch
2021-09-10 11:58:15 +00:00

62 lines
2.8 KiB
Diff

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