0a7476
From c1496d42e09be681644df89059ffa9fbb5417401 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <c1496d42e09be681644df89059ffa9fbb5417401@dist-git>
0a7476
From: John Ferlan <jferlan@redhat.com>
0a7476
Date: Wed, 3 Apr 2019 09:12:17 -0400
0a7476
Subject: [PATCH] tests: Add storagepool xml test for netfs-auto
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
https://bugzilla.redhat.com/show_bug.cgi?id=1584663
0a7476
0a7476
Cover the case where @netauto would be used to create the command
0a7476
line in virStorageBackendFileSystemMountCmd. Essentially when the
0a7476
pool type is "netfs", but the "source.format" is empty, create the
0a7476
command line properly.
0a7476
0a7476
Signed-off-by: John Ferlan <jferlan@redhat.com>
0a7476
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
(cherry picked from commit 515aa0c1847180f8da4287270f872c161993a047)
0a7476
Message-Id: <20190403131219.16385-6-jferlan@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
---
0a7476
 .../pool-netfs-auto.argv                      |  1 +
0a7476
 tests/storagepoolxml2argvtest.c               |  1 +
0a7476
 .../storagepoolxml2xmlin/pool-netfs-auto.xml  | 19 ++++++++++++++++++
0a7476
 .../storagepoolxml2xmlout/pool-netfs-auto.xml | 20 +++++++++++++++++++
0a7476
 tests/storagepoolxml2xmltest.c                |  1 +
0a7476
 5 files changed, 42 insertions(+)
0a7476
 create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-auto.argv
0a7476
 create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-auto.xml
0a7476
 create mode 100644 tests/storagepoolxml2xmlout/pool-netfs-auto.xml
0a7476
0a7476
diff --git a/tests/storagepoolxml2argvdata/pool-netfs-auto.argv b/tests/storagepoolxml2argvdata/pool-netfs-auto.argv
0a7476
new file mode 100644
0a7476
index 0000000000..888a0161b8
0a7476
--- /dev/null
0a7476
+++ b/tests/storagepoolxml2argvdata/pool-netfs-auto.argv
0a7476
@@ -0,0 +1 @@
0a7476
+mount localhost:/var/lib/libvirt/images /mnt
0a7476
diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
0a7476
index 54bc07b4e1..3bf2c3b003 100644
0a7476
--- a/tests/storagepoolxml2argvtest.c
0a7476
+++ b/tests/storagepoolxml2argvtest.c
0a7476
@@ -146,6 +146,7 @@ mymain(void)
0a7476
     DO_TEST_FAIL("pool-iscsi");
0a7476
     DO_TEST_FAIL("pool-iscsi-auth");
0a7476
     DO_TEST("pool-netfs");
0a7476
+    DO_TEST("pool-netfs-auto");
0a7476
     DO_TEST("pool-netfs-gluster");
0a7476
     DO_TEST("pool-netfs-cifs");
0a7476
     DO_TEST_FAIL("pool-scsi");
0a7476
diff --git a/tests/storagepoolxml2xmlin/pool-netfs-auto.xml b/tests/storagepoolxml2xmlin/pool-netfs-auto.xml
0a7476
new file mode 100644
0a7476
index 0000000000..d7f7ce8168
0a7476
--- /dev/null
0a7476
+++ b/tests/storagepoolxml2xmlin/pool-netfs-auto.xml
0a7476
@@ -0,0 +1,19 @@
0a7476
+<pool type='netfs'>
0a7476
+  <name>nfsimages</name>
0a7476
+  <uuid>7641d5a8-af11-f730-a34e-0a7dfcede71f</uuid>
0a7476
+  <capacity>0</capacity>
0a7476
+  <allocation>0</allocation>
0a7476
+  <available>0</available>
0a7476
+  <source>
0a7476
+    <host name='localhost'/>
0a7476
+    <dir path='/var/lib/libvirt/images'/>
0a7476
+  </source>
0a7476
+  <target>
0a7476
+    <path>/mnt</path>
0a7476
+    <permissions>
0a7476
+      <mode>0700</mode>
0a7476
+      <owner>0</owner>
0a7476
+      <group>0</group>
0a7476
+    </permissions>
0a7476
+  </target>
0a7476
+</pool>
0a7476
diff --git a/tests/storagepoolxml2xmlout/pool-netfs-auto.xml b/tests/storagepoolxml2xmlout/pool-netfs-auto.xml
0a7476
new file mode 100644
0a7476
index 0000000000..a180ca521c
0a7476
--- /dev/null
0a7476
+++ b/tests/storagepoolxml2xmlout/pool-netfs-auto.xml
0a7476
@@ -0,0 +1,20 @@
0a7476
+<pool type='netfs'>
0a7476
+  <name>nfsimages</name>
0a7476
+  <uuid>7641d5a8-af11-f730-a34e-0a7dfcede71f</uuid>
0a7476
+  <capacity unit='bytes'>0</capacity>
0a7476
+  <allocation unit='bytes'>0</allocation>
0a7476
+  <available unit='bytes'>0</available>
0a7476
+  <source>
0a7476
+    <host name='localhost'/>
0a7476
+    <dir path='/var/lib/libvirt/images'/>
0a7476
+    <format type='auto'/>
0a7476
+  </source>
0a7476
+  <target>
0a7476
+    <path>/mnt</path>
0a7476
+    <permissions>
0a7476
+      <mode>0700</mode>
0a7476
+      <owner>0</owner>
0a7476
+      <group>0</group>
0a7476
+    </permissions>
0a7476
+  </target>
0a7476
+</pool>
0a7476
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
0a7476
index 974f0afe39..29c0e42479 100644
0a7476
--- a/tests/storagepoolxml2xmltest.c
0a7476
+++ b/tests/storagepoolxml2xmltest.c
0a7476
@@ -85,6 +85,7 @@ mymain(void)
0a7476
     DO_TEST("pool-iscsi");
0a7476
     DO_TEST("pool-iscsi-auth");
0a7476
     DO_TEST("pool-netfs");
0a7476
+    DO_TEST("pool-netfs-auto");
0a7476
     DO_TEST("pool-netfs-gluster");
0a7476
     DO_TEST("pool-netfs-cifs");
0a7476
     DO_TEST("pool-scsi");
0a7476
-- 
0a7476
2.21.0
0a7476