diff mbox series

oeqa: add Git mirror test

Message ID 20180621161815.19449-1-ross.burton@intel.com
State Accepted
Commit 13269dfbbc62faef32595343dc78250fdb2a2946
Headers show
Series oeqa: add Git mirror test | expand

Commit Message

Ross Burton June 21, 2018, 4:18 p.m. UTC
Add an automated test to exercise that fetching a git: recipe...
1) works over git without mirrors
2) fails without git connectivity or mirrors
3) works without git connectivity but with a mirror

(2) is done by setting GIT_PROXY_COMMAND to 'false' which should break any git
network operations.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/lib/oeqa/selftest/cases/fetch.py | 49 +++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 meta/lib/oeqa/selftest/cases/fetch.py

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/fetch.py b/meta/lib/oeqa/selftest/cases/fetch.py
new file mode 100644
index 00000000000..4acc8cdcc8e
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/fetch.py
@@ -0,0 +1,49 @@ 
+import oe.path
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake
+from oeqa.core.decorator.oeid import OETestID
+
+class Fetch(OESelftestTestCase):
+    @OETestID(1058)
+    def test_git_mirrors(self):
+        """
+        Verify that the git fetcher will fall back to the HTTP mirrors. The
+        recipe needs to be one that we have on the Yocto Project source mirror
+        and is hosted in git.
+        """
+
+        # TODO: mktempd instead of hardcoding
+        dldir = os.path.join(self.builddir, "download-git-mirrors")
+        self.track_for_cleanup(dldir)
+
+        # No mirrors, should use git to fetch successfully
+        features = """
+DL_DIR = "%s"
+MIRRORS_forcevariable = ""
+PREMIRRORS_forcevariable = ""
+""" % dldir
+        self.write_config(features)
+        oe.path.remove(dldir, recurse=True)
+        bitbake("dbus-wait -c fetch -f")
+
+        # No mirrors and broken git, should fail
+        features = """
+DL_DIR = "%s"
+GIT_PROXY_COMMAND = "false"
+MIRRORS_forcevariable = ""
+PREMIRRORS_forcevariable = ""
+""" % dldir
+        self.write_config(features)
+        oe.path.remove(dldir, recurse=True)
+        with self.assertRaises(AssertionError):
+            bitbake("dbus-wait -c fetch -f")
+
+        # Broken git but a specific mirror
+        features = """
+DL_DIR = "%s"
+GIT_PROXY_COMMAND = "false"
+MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/sources/"
+""" % dldir
+        self.write_config(features)
+        oe.path.remove(dldir, recurse=True)
+        bitbake("dbus-wait -c fetch -f")