From e2419869e7fd4e6e5b04eb7914c2f88e842630ed Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 8 Sep 2020 17:48:40 -0400 Subject: [PATCH] tests: data: Move all cli/ bits to their own directories Move the content to: * cli/virtclone/ * cli/unattended/ * fakemedia/ Signed-off-by: Cole Robinson --- .../virt-install-cdrom-centos-label.xml | 2 +- .../cli/compare/virt-install-location-iso.xml | 2 +- .../virt-install-location-manual-kernel.xml | 2 +- ...virt-install-osinfo-netinst-unattended.xml | 2 +- .../virt-install-osinfo-win7-unattended.xml | 4 ++-- .../compare/virt-install-reinstall-cdrom.xml | 4 ++-- .../cli/{ => unattended}/admin-password.txt | 0 .../cli/{ => unattended}/user-password.txt | 0 .../clone-disk-managed.xml | 0 .../clone-disk-noexist.xml | 0 .../cli/{clone => virtclone}/clone-disk.xml | 0 .../cli/{clone => virtclone}/clone-empty.xml | 0 .../{clone => virtclone}/clone-nvram-auto.xml | 0 .../clone-nvram-missing.xml | 0 .../clone-nvram-newpool.xml | 0 .../fake-centos65-label.iso | Bin .../{cli => fakemedia}/fake-f26-netinst.iso | Bin .../data/{cli => fakemedia}/fake-f29-live.iso | Bin .../{cli => fakemedia}/fake-fedora17-tree.iso | Bin .../{cli => fakemedia}/fake-no-osinfo.iso | Bin tests/data/{cli => fakemedia}/fake-win7.iso | Bin .../fakefedoratree/.treeinfo | 0 .../fakefedoratree/images/boot.iso | 0 .../fakefedoratree/images/pxeboot/initrd.img | 0 .../fakefedoratree/images/pxeboot/vmlinuz | 0 .../fakefedoratree/images/xen/initrd.img | 0 .../fakefedoratree/images/xen/vmlinuz | 0 .../fakerhel6tree/.treeinfo | 0 .../fakerhel6tree/images/boot.iso | 0 .../fakerhel6tree/images/pxeboot/initrd.img | 0 .../fakerhel6tree/images/pxeboot/vmlinuz | 0 .../fakerhel6tree/images/xen/initrd.img | 0 .../fakerhel6tree/images/xen/vmlinuz | 0 tests/test_cli.py | 22 ++++++++++-------- tests/test_cloner.py | 2 +- tests/test_xmlconfig.py | 4 ++-- tests/urlfetcher_mock.py | 2 +- 37 files changed, 24 insertions(+), 22 deletions(-) rename tests/data/cli/{ => unattended}/admin-password.txt (100%) rename tests/data/cli/{ => unattended}/user-password.txt (100%) rename tests/data/cli/{clone => virtclone}/clone-disk-managed.xml (100%) rename tests/data/cli/{clone => virtclone}/clone-disk-noexist.xml (100%) rename tests/data/cli/{clone => virtclone}/clone-disk.xml (100%) rename tests/data/cli/{clone => virtclone}/clone-empty.xml (100%) rename tests/data/cli/{clone => virtclone}/clone-nvram-auto.xml (100%) rename tests/data/cli/{clone => virtclone}/clone-nvram-missing.xml (100%) rename tests/data/cli/{clone => virtclone}/clone-nvram-newpool.xml (100%) rename tests/data/{cli => fakemedia}/fake-centos65-label.iso (100%) rename tests/data/{cli => fakemedia}/fake-f26-netinst.iso (100%) rename tests/data/{cli => fakemedia}/fake-f29-live.iso (100%) rename tests/data/{cli => fakemedia}/fake-fedora17-tree.iso (100%) rename tests/data/{cli => fakemedia}/fake-no-osinfo.iso (100%) rename tests/data/{cli => fakemedia}/fake-win7.iso (100%) rename tests/data/{cli => fakemedia}/fakefedoratree/.treeinfo (100%) rename tests/data/{cli => fakemedia}/fakefedoratree/images/boot.iso (100%) rename tests/data/{cli => fakemedia}/fakefedoratree/images/pxeboot/initrd.img (100%) rename tests/data/{cli => fakemedia}/fakefedoratree/images/pxeboot/vmlinuz (100%) rename tests/data/{cli => fakemedia}/fakefedoratree/images/xen/initrd.img (100%) rename tests/data/{cli => fakemedia}/fakefedoratree/images/xen/vmlinuz (100%) rename tests/data/{cli => fakemedia}/fakerhel6tree/.treeinfo (100%) rename tests/data/{cli => fakemedia}/fakerhel6tree/images/boot.iso (100%) rename tests/data/{cli => fakemedia}/fakerhel6tree/images/pxeboot/initrd.img (100%) rename tests/data/{cli => fakemedia}/fakerhel6tree/images/pxeboot/vmlinuz (100%) rename tests/data/{cli => fakemedia}/fakerhel6tree/images/xen/initrd.img (100%) rename tests/data/{cli => fakemedia}/fakerhel6tree/images/xen/vmlinuz (100%) diff --git a/tests/data/cli/compare/virt-install-cdrom-centos-label.xml b/tests/data/cli/compare/virt-install-cdrom-centos-label.xml index 95f4a2fd..7b060470 100644 --- a/tests/data/cli/compare/virt-install-cdrom-centos-label.xml +++ b/tests/data/cli/compare/virt-install-cdrom-centos-label.xml @@ -39,7 +39,7 @@ - + diff --git a/tests/data/cli/compare/virt-install-location-iso.xml b/tests/data/cli/compare/virt-install-location-iso.xml index 8a5a4bcf..366478a5 100644 --- a/tests/data/cli/compare/virt-install-location-iso.xml +++ b/tests/data/cli/compare/virt-install-location-iso.xml @@ -39,7 +39,7 @@ - + diff --git a/tests/data/cli/compare/virt-install-location-manual-kernel.xml b/tests/data/cli/compare/virt-install-location-manual-kernel.xml index fbb1b5d3..f9fc1e12 100644 --- a/tests/data/cli/compare/virt-install-location-manual-kernel.xml +++ b/tests/data/cli/compare/virt-install-location-manual-kernel.xml @@ -29,7 +29,7 @@ /usr/bin/qemu-kvm - + diff --git a/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml b/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml index 8a1fb075..6863ad07 100644 --- a/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml +++ b/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml @@ -34,7 +34,7 @@ /usr/bin/qemu-kvm - + diff --git a/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml b/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml index ab8e13fc..e5e2f70a 100644 --- a/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml +++ b/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml @@ -38,7 +38,7 @@ /usr/bin/qemu-kvm - + @@ -113,7 +113,7 @@ /usr/bin/qemu-kvm - + diff --git a/tests/data/cli/compare/virt-install-reinstall-cdrom.xml b/tests/data/cli/compare/virt-install-reinstall-cdrom.xml index b7618dc6..72141b65 100644 --- a/tests/data/cli/compare/virt-install-reinstall-cdrom.xml +++ b/tests/data/cli/compare/virt-install-reinstall-cdrom.xml @@ -17,7 +17,7 @@
- + @@ -51,7 +51,7 @@
- + diff --git a/tests/data/cli/admin-password.txt b/tests/data/cli/unattended/admin-password.txt similarity index 100% rename from tests/data/cli/admin-password.txt rename to tests/data/cli/unattended/admin-password.txt diff --git a/tests/data/cli/user-password.txt b/tests/data/cli/unattended/user-password.txt similarity index 100% rename from tests/data/cli/user-password.txt rename to tests/data/cli/unattended/user-password.txt diff --git a/tests/data/cli/clone/clone-disk-managed.xml b/tests/data/cli/virtclone/clone-disk-managed.xml similarity index 100% rename from tests/data/cli/clone/clone-disk-managed.xml rename to tests/data/cli/virtclone/clone-disk-managed.xml diff --git a/tests/data/cli/clone/clone-disk-noexist.xml b/tests/data/cli/virtclone/clone-disk-noexist.xml similarity index 100% rename from tests/data/cli/clone/clone-disk-noexist.xml rename to tests/data/cli/virtclone/clone-disk-noexist.xml diff --git a/tests/data/cli/clone/clone-disk.xml b/tests/data/cli/virtclone/clone-disk.xml similarity index 100% rename from tests/data/cli/clone/clone-disk.xml rename to tests/data/cli/virtclone/clone-disk.xml diff --git a/tests/data/cli/clone/clone-empty.xml b/tests/data/cli/virtclone/clone-empty.xml similarity index 100% rename from tests/data/cli/clone/clone-empty.xml rename to tests/data/cli/virtclone/clone-empty.xml diff --git a/tests/data/cli/clone/clone-nvram-auto.xml b/tests/data/cli/virtclone/clone-nvram-auto.xml similarity index 100% rename from tests/data/cli/clone/clone-nvram-auto.xml rename to tests/data/cli/virtclone/clone-nvram-auto.xml diff --git a/tests/data/cli/clone/clone-nvram-missing.xml b/tests/data/cli/virtclone/clone-nvram-missing.xml similarity index 100% rename from tests/data/cli/clone/clone-nvram-missing.xml rename to tests/data/cli/virtclone/clone-nvram-missing.xml diff --git a/tests/data/cli/clone/clone-nvram-newpool.xml b/tests/data/cli/virtclone/clone-nvram-newpool.xml similarity index 100% rename from tests/data/cli/clone/clone-nvram-newpool.xml rename to tests/data/cli/virtclone/clone-nvram-newpool.xml diff --git a/tests/data/cli/fake-centos65-label.iso b/tests/data/fakemedia/fake-centos65-label.iso similarity index 100% rename from tests/data/cli/fake-centos65-label.iso rename to tests/data/fakemedia/fake-centos65-label.iso diff --git a/tests/data/cli/fake-f26-netinst.iso b/tests/data/fakemedia/fake-f26-netinst.iso similarity index 100% rename from tests/data/cli/fake-f26-netinst.iso rename to tests/data/fakemedia/fake-f26-netinst.iso diff --git a/tests/data/cli/fake-f29-live.iso b/tests/data/fakemedia/fake-f29-live.iso similarity index 100% rename from tests/data/cli/fake-f29-live.iso rename to tests/data/fakemedia/fake-f29-live.iso diff --git a/tests/data/cli/fake-fedora17-tree.iso b/tests/data/fakemedia/fake-fedora17-tree.iso similarity index 100% rename from tests/data/cli/fake-fedora17-tree.iso rename to tests/data/fakemedia/fake-fedora17-tree.iso diff --git a/tests/data/cli/fake-no-osinfo.iso b/tests/data/fakemedia/fake-no-osinfo.iso similarity index 100% rename from tests/data/cli/fake-no-osinfo.iso rename to tests/data/fakemedia/fake-no-osinfo.iso diff --git a/tests/data/cli/fake-win7.iso b/tests/data/fakemedia/fake-win7.iso similarity index 100% rename from tests/data/cli/fake-win7.iso rename to tests/data/fakemedia/fake-win7.iso diff --git a/tests/data/cli/fakefedoratree/.treeinfo b/tests/data/fakemedia/fakefedoratree/.treeinfo similarity index 100% rename from tests/data/cli/fakefedoratree/.treeinfo rename to tests/data/fakemedia/fakefedoratree/.treeinfo diff --git a/tests/data/cli/fakefedoratree/images/boot.iso b/tests/data/fakemedia/fakefedoratree/images/boot.iso similarity index 100% rename from tests/data/cli/fakefedoratree/images/boot.iso rename to tests/data/fakemedia/fakefedoratree/images/boot.iso diff --git a/tests/data/cli/fakefedoratree/images/pxeboot/initrd.img b/tests/data/fakemedia/fakefedoratree/images/pxeboot/initrd.img similarity index 100% rename from tests/data/cli/fakefedoratree/images/pxeboot/initrd.img rename to tests/data/fakemedia/fakefedoratree/images/pxeboot/initrd.img diff --git a/tests/data/cli/fakefedoratree/images/pxeboot/vmlinuz b/tests/data/fakemedia/fakefedoratree/images/pxeboot/vmlinuz similarity index 100% rename from tests/data/cli/fakefedoratree/images/pxeboot/vmlinuz rename to tests/data/fakemedia/fakefedoratree/images/pxeboot/vmlinuz diff --git a/tests/data/cli/fakefedoratree/images/xen/initrd.img b/tests/data/fakemedia/fakefedoratree/images/xen/initrd.img similarity index 100% rename from tests/data/cli/fakefedoratree/images/xen/initrd.img rename to tests/data/fakemedia/fakefedoratree/images/xen/initrd.img diff --git a/tests/data/cli/fakefedoratree/images/xen/vmlinuz b/tests/data/fakemedia/fakefedoratree/images/xen/vmlinuz similarity index 100% rename from tests/data/cli/fakefedoratree/images/xen/vmlinuz rename to tests/data/fakemedia/fakefedoratree/images/xen/vmlinuz diff --git a/tests/data/cli/fakerhel6tree/.treeinfo b/tests/data/fakemedia/fakerhel6tree/.treeinfo similarity index 100% rename from tests/data/cli/fakerhel6tree/.treeinfo rename to tests/data/fakemedia/fakerhel6tree/.treeinfo diff --git a/tests/data/cli/fakerhel6tree/images/boot.iso b/tests/data/fakemedia/fakerhel6tree/images/boot.iso similarity index 100% rename from tests/data/cli/fakerhel6tree/images/boot.iso rename to tests/data/fakemedia/fakerhel6tree/images/boot.iso diff --git a/tests/data/cli/fakerhel6tree/images/pxeboot/initrd.img b/tests/data/fakemedia/fakerhel6tree/images/pxeboot/initrd.img similarity index 100% rename from tests/data/cli/fakerhel6tree/images/pxeboot/initrd.img rename to tests/data/fakemedia/fakerhel6tree/images/pxeboot/initrd.img diff --git a/tests/data/cli/fakerhel6tree/images/pxeboot/vmlinuz b/tests/data/fakemedia/fakerhel6tree/images/pxeboot/vmlinuz similarity index 100% rename from tests/data/cli/fakerhel6tree/images/pxeboot/vmlinuz rename to tests/data/fakemedia/fakerhel6tree/images/pxeboot/vmlinuz diff --git a/tests/data/cli/fakerhel6tree/images/xen/initrd.img b/tests/data/fakemedia/fakerhel6tree/images/xen/initrd.img similarity index 100% rename from tests/data/cli/fakerhel6tree/images/xen/initrd.img rename to tests/data/fakemedia/fakerhel6tree/images/xen/initrd.img diff --git a/tests/data/cli/fakerhel6tree/images/xen/vmlinuz b/tests/data/fakemedia/fakerhel6tree/images/xen/vmlinuz similarity index 100% rename from tests/data/cli/fakerhel6tree/images/xen/vmlinuz rename to tests/data/fakemedia/fakerhel6tree/images/xen/vmlinuz diff --git a/tests/test_cli.py b/tests/test_cli.py index 53802edd..d3d5c672 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -34,6 +34,8 @@ os.environ["DISPLAY"] = ":3.4" TMP_IMAGE_DIR = "/tmp/__virtinst_cli_" _ABSXMLDIR = utils.DATADIR + "/cli" XMLDIR = os.path.relpath(_ABSXMLDIR, utils.TOPDIR) +MEDIA_DIR = os.path.relpath(utils.DATADIR + "/fakemedia", utils.TOPDIR) +UNATTENDED_DIR = XMLDIR + "/unattended" OLD_OSINFO = utils.has_old_osinfo() NO_OSINFO_UNATTEND = not unattended.OSInstallScript.have_new_libosinfo() HAS_ISOINFO = shutil.which("isoinfo") @@ -79,16 +81,16 @@ TEST_DATA = { 'EXISTIMG2': "/dev/default-pool/testvol2.img", 'EXISTIMG3': EXIST_FILES[0], 'EXISTIMG4': EXIST_FILES[1], - 'ISOTREE': "%s/fake-fedora17-tree.iso" % XMLDIR, - 'ISOLABEL': "%s/fake-centos65-label.iso" % XMLDIR, - 'ISO-NO-OS': "%s/fake-no-osinfo.iso" % XMLDIR, - 'ISO-WIN7': "%s/fake-win7.iso" % XMLDIR, - 'ISO-F26-NETINST': "%s/fake-f26-netinst.iso" % XMLDIR, - 'ISO-F29-LIVE': "%s/fake-f29-live.iso" % XMLDIR, - 'TREEDIR': "%s/fakefedoratree" % XMLDIR, + 'ISOTREE': "%s/fake-fedora17-tree.iso" % MEDIA_DIR, + 'ISOLABEL': "%s/fake-centos65-label.iso" % MEDIA_DIR, + 'ISO-NO-OS': "%s/fake-no-osinfo.iso" % MEDIA_DIR, + 'ISO-WIN7': "%s/fake-win7.iso" % MEDIA_DIR, + 'ISO-F26-NETINST': "%s/fake-f26-netinst.iso" % MEDIA_DIR, + 'ISO-F29-LIVE': "%s/fake-f29-live.iso" % MEDIA_DIR, + 'TREEDIR': "%s/fakefedoratree" % MEDIA_DIR, 'COLLIDE': "/dev/default-pool/collidevol1.img", - 'ADMIN-PASSWORD-FILE': "%s/admin-password.txt" % XMLDIR, - 'USER-PASSWORD-FILE': "%s/user-password.txt" % XMLDIR, + 'ADMIN-PASSWORD-FILE': "%s/admin-password.txt" % UNATTENDED_DIR, + 'USER-PASSWORD-FILE': "%s/user-password.txt" % UNATTENDED_DIR, } @@ -1300,7 +1302,7 @@ c.add_compare("--add-device --network default --os-variant http://fedoraproject. # virt-clone tests # #################### -_CLONEXMLDIR = XMLDIR + "/clone" +_CLONEXMLDIR = XMLDIR + "/virtclone" _CLONE_UNMANAGED = "--original-xml %s/clone-disk.xml" % _CLONEXMLDIR _CLONE_MANAGED = "--original-xml %s/clone-disk-managed.xml" % _CLONEXMLDIR _CLONE_NOEXIST = "--original-xml %s/clone-disk-noexist.xml" % _CLONEXMLDIR diff --git a/tests/test_cloner.py b/tests/test_cloner.py index 01df2fbf..eeb68526 100644 --- a/tests/test_cloner.py +++ b/tests/test_cloner.py @@ -11,7 +11,7 @@ from tests import utils from virtinst import Cloner -CLI_XMLDIR = utils.DATADIR + "/cli/clone/" +CLI_XMLDIR = utils.DATADIR + "/cli/virtclone/" def test_clone_unmanaged(): diff --git a/tests/test_xmlconfig.py b/tests/test_xmlconfig.py index ee430659..edf22b90 100644 --- a/tests/test_xmlconfig.py +++ b/tests/test_xmlconfig.py @@ -120,13 +120,13 @@ class TestXMLMisc(unittest.TestCase): # Simple sanity test to make sure detect_distro works. test-urls # does much more exhaustive testing but it's only run occasionally i = _make_installer( - location=utils.DATADIR + "/cli/fakefedoratree") + location=utils.DATADIR + "/fakemedia/fakefedoratree") g = _make_guest() v = i.detect_distro(g) self.assertEqual(v, "fedora17") i = _make_installer( - location=utils.DATADIR + "/cli/fakerhel6tree") + location=utils.DATADIR + "/fakemedia/fakerhel6tree") g = _make_guest() v = i.detect_distro(g) self.assertEqual(v, "rhel6.0") diff --git a/tests/urlfetcher_mock.py b/tests/urlfetcher_mock.py index 8c55ed59..ec1d8cf7 100644 --- a/tests/urlfetcher_mock.py +++ b/tests/urlfetcher_mock.py @@ -29,7 +29,7 @@ def _map_mock_url_to_file(url): elif url.endswith("treeinfo"): # If the url is requesting treeinfo, give a fake treeinfo from # our testsuite data - fn = ("%s/data/cli/fakerhel6tree/.treeinfo" % + fn = ("%s/data/fakemedia/fakerhel6tree/.treeinfo" % os.path.abspath(os.path.dirname(__file__))) else: # Otherwise just copy this file