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