From 2f00478986d0d737d8eb042bbe24953200ee7080 Mon Sep 17 00:00:00 2001 From: Dmitry Ivankov Date: Thu, 11 Sep 2025 12:31:06 +0200 Subject: [PATCH 1/2] create_jvm_test_suite: fail on empty tests list `native.test_suite` will treat empty tests list as all tests in package https://bazel.build/reference/be/general#test_suite.tests which can be confusing, and likely pointing to a bug if `test_suffixes` or test file names, so failing instead makes sense --- java/private/create_jvm_test_suite.bzl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/private/create_jvm_test_suite.bzl b/java/private/create_jvm_test_suite.bzl index c86a6609..63fcfd5b 100644 --- a/java/private/create_jvm_test_suite.bzl +++ b/java/private/create_jvm_test_suite.bzl @@ -121,6 +121,11 @@ def create_jvm_test_suite( ) tests.append(test_name) + if not tests: + # test_suite with tests=[] would create a suite containing ALL tests in current package + # which would be confusing + fail("create_jvm_test_suite tests list is empty, do test files follow test_suffixes pattern?") + native.test_suite( name = name, tests = tests, From dcd7fb884492c14370447540e9acd7d786487460 Mon Sep 17 00:00:00 2001 From: Dmitry Ivankov Date: Thu, 11 Sep 2025 12:36:55 +0200 Subject: [PATCH 2/2] Update java/private/create_jvm_test_suite.bzl Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- java/private/create_jvm_test_suite.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/private/create_jvm_test_suite.bzl b/java/private/create_jvm_test_suite.bzl index 63fcfd5b..61b604a6 100644 --- a/java/private/create_jvm_test_suite.bzl +++ b/java/private/create_jvm_test_suite.bzl @@ -124,7 +124,7 @@ def create_jvm_test_suite( if not tests: # test_suite with tests=[] would create a suite containing ALL tests in current package # which would be confusing - fail("create_jvm_test_suite tests list is empty, do test files follow test_suffixes pattern?") + fail("No tests found for suite '{}'. Do test files match 'test_suffixes'?".format(name)) native.test_suite( name = name,