1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

bitbake: tests/fetch.py: add test case for using premirror in restricted network

We had issue when BB_ALLOWED_NETWORKS is set and `bitbake grpc-native -c fetch'
failed even with all contents available in PREMIRRORS.

Add a test case to ensure no regression in the future.

(Bitbake rev: 80c91ceb81b1cae203067af58d3f1fe9c619ae83)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi
2024-01-31 19:30:59 -08:00
committed by Richard Purdie
parent c984b03f02
commit 09ecbcd307
+19
View File
@@ -1107,6 +1107,25 @@ class FetcherNetworkTest(FetcherTest):
if os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1')):
self.assertTrue(os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1', 'bitbake')), msg='submodule of submodule missing')
@skipIfNoNetwork()
def test_git_submodule_restricted_network_premirrors(self):
# this test is to ensure that premirrors will be tried in restricted network
# that is, BB_ALLOWED_NETWORKS does not contain the domain the url uses
url = "gitsm://github.com/grpc/grpc.git;protocol=https;name=grpc;branch=v1.60.x;rev=0ef13a7555dbaadd4633399242524129eef5e231"
# create a download directory to be used as premirror later
tempdir = tempfile.mkdtemp(prefix="bitbake-fetch-")
dl_premirror = os.path.join(tempdir, "download-premirror")
os.mkdir(dl_premirror)
self.d.setVar("DL_DIR", dl_premirror)
fetcher = bb.fetch.Fetch([url], self.d)
fetcher.download()
# now use the premirror in restricted network
self.d.setVar("DL_DIR", self.dldir)
self.d.setVar("PREMIRRORS", "gitsm://.*/.* gitsm://%s/git2/MIRRORNAME;protocol=file" % dl_premirror)
self.d.setVar("BB_ALLOWED_NETWORKS", "*.some.domain")
fetcher = bb.fetch.Fetch([url], self.d)
fetcher.download()
@skipIfNoNetwork()
def test_git_submodule_dbus_broker(self):
# The following external repositories have show failures in fetch and unpack operations