diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2024-01-31 19:30:59 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 15:08:30 +0000 |
commit | 09ecbcd307ee86f76238968aa8ed0005a5373b5d (patch) | |
tree | 072c27be617d5f89125a201b06a553a45714d7e8 /bitbake/lib/bb/tests/fetch.py | |
parent | c984b03f0275084566527559ea29bc480d7c27cb (diff) | |
download | poky-09ecbcd307ee86f76238968aa8ed0005a5373b5d.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index fc94f4c02f..522d89de65 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1108,6 +1108,25 @@ class FetcherNetworkTest(FetcherTest): | |||
1108 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1', 'bitbake')), msg='submodule of submodule missing') | 1108 | self.assertTrue(os.path.exists(os.path.join(repo_path, 'bitbake-gitsm-test1', 'bitbake')), msg='submodule of submodule missing') |
1109 | 1109 | ||
1110 | @skipIfNoNetwork() | 1110 | @skipIfNoNetwork() |
1111 | def test_git_submodule_restricted_network_premirrors(self): | ||
1112 | # this test is to ensure that premirrors will be tried in restricted network | ||
1113 | # that is, BB_ALLOWED_NETWORKS does not contain the domain the url uses | ||
1114 | url = "gitsm://github.com/grpc/grpc.git;protocol=https;name=grpc;branch=v1.60.x;rev=0ef13a7555dbaadd4633399242524129eef5e231" | ||
1115 | # create a download directory to be used as premirror later | ||
1116 | tempdir = tempfile.mkdtemp(prefix="bitbake-fetch-") | ||
1117 | dl_premirror = os.path.join(tempdir, "download-premirror") | ||
1118 | os.mkdir(dl_premirror) | ||
1119 | self.d.setVar("DL_DIR", dl_premirror) | ||
1120 | fetcher = bb.fetch.Fetch([url], self.d) | ||
1121 | fetcher.download() | ||
1122 | # now use the premirror in restricted network | ||
1123 | self.d.setVar("DL_DIR", self.dldir) | ||
1124 | self.d.setVar("PREMIRRORS", "gitsm://.*/.* gitsm://%s/git2/MIRRORNAME;protocol=file" % dl_premirror) | ||
1125 | self.d.setVar("BB_ALLOWED_NETWORKS", "*.some.domain") | ||
1126 | fetcher = bb.fetch.Fetch([url], self.d) | ||
1127 | fetcher.download() | ||
1128 | |||
1129 | @skipIfNoNetwork() | ||
1111 | def test_git_submodule_dbus_broker(self): | 1130 | def test_git_submodule_dbus_broker(self): |
1112 | # The following external repositories have show failures in fetch and unpack operations | 1131 | # The following external repositories have show failures in fetch and unpack operations |
1113 | # We want to avoid regressions! | 1132 | # We want to avoid regressions! |