diff --git a/.bazelci/postsubmit.yml b/.bazelci/postsubmit.yml index 4bbb306e3c5c4a..ac052deee45bb9 100644 --- a/.bazelci/postsubmit.yml +++ b/.bazelci/postsubmit.yml @@ -200,7 +200,10 @@ tasks: - "//src:test_repos" test_flags: - "--config=ci-macos" - - "--noremote_accept_cached" + # Fine tune the number of test jobs running in parallel to avoid timeout + - "--local_test_jobs=2" + # Increase the test timeout by 20% to avoid flaky test failures due to timeout + - "--test_timeout=72,360,1080,4320" test_targets: - "//scripts/..." - "//src/main/starlark/tests/builtins_bzl/..." diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 69bf136a5c86a3..ad1d6c67e58c31 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -177,6 +177,7 @@ tasks: # Disable python and shell integration tests on Intel Macs - "-//src/test/shell/..." - "-//src/test/py/..." + - "-//src/main/starlark/tests/builtins_bzl:cc_builtin_tests" # https://github.com/bazelbuild/bazel/issues/17410 - "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest" # Disable android tests since we are moving Android rules out of the Bazel repo. @@ -201,6 +202,10 @@ tasks: - "//src:test_repos" test_flags: - "--config=ci-macos" + # Fine tune the number of test jobs running in parallel to avoid timeout + - "--local_test_jobs=2" + # Increase the test timeout by 20% to avoid flaky test failures due to timeout + - "--test_timeout=72,360,1080,4320" test_targets: - "//scripts/..." - "//src/main/starlark/tests/builtins_bzl/..." diff --git a/src/test/py/bazel/bzlmod/bazel_overrides_test.py b/src/test/py/bazel/bzlmod/bazel_overrides_test.py index 0f6ebf8d728472..df143390df6529 100644 --- a/src/test/py/bazel/bzlmod/bazel_overrides_test.py +++ b/src/test/py/bazel/bzlmod/bazel_overrides_test.py @@ -400,7 +400,7 @@ def testCmdAbsoluteModuleOverride(self): 'bazel_dep(name = "ss", version = "1.0")', 'local_path_override(', ' module_name = "ss",', - ' path = "%s",' % self.Path('aa'), + ' path = "%s",' % self.Path('aa').replace('\\', '/'), ')', ], ) diff --git a/tools/build_defs/pkg/path_test.py b/tools/build_defs/pkg/path_test.py index 934b61a4ad0714..9d7e7f78459782 100644 --- a/tools/build_defs/pkg/path_test.py +++ b/tools/build_defs/pkg/path_test.py @@ -13,12 +13,16 @@ # limitations under the License. """Testing for helper functions.""" -import imp +import importlib.machinery +import importlib.util import unittest -pkg_bzl = imp.load_source( - 'pkg_bzl', - 'tools/build_defs/pkg/path.bzl') + +loader = importlib.machinery.SourceFileLoader( + 'pkg_bzl', 'tools/build_defs/pkg/path.bzl') +spec = importlib.util.spec_from_loader(loader.name, loader) +pkg_bzl = importlib.util.module_from_spec(spec) +loader.exec_module(pkg_bzl) class File(object):