Improve visibility of the integration tests Changes: * add `Abstract*Test.java` classes to common tests bazel library * extract unit tests to the bazel test target * extract each integration test to the bazel test target As a result: * unit tests and each integration test are executed in parallel (especially beneficial in RBE) improving the visbility in case of failure as it will be reported against the unit tests or the specific integration test * locally the test time is reduced on M1 from ~25 to ~18 Note that `@Ignore` annotation on `AbstractHealthCheckIntegrationTest` is no longer needed hence it was removed. Change-Id: Ie3b979c5b2e8d39576834ce1e8815b5e8ef8969c
diff --git a/BUILD b/BUILD index 24a2d60..5077015 100644 --- a/BUILD +++ b/BUILD
@@ -20,18 +20,37 @@ junit_tests( name = "healthcheck_tests", - srcs = glob(["src/test/java/**/*.java"]), + srcs = glob( + [ + "src/test/java/**/*Test.java", + ], + exclude = ["src/test/java/**/Abstract*.java"], + ), resources = glob(["src/test/resources/**/*"]), deps = [ ":healthcheck__plugin_test_deps", ], ) +[junit_tests( + name = f[:f.index(".")].replace("/", "_"), + srcs = [f], + tags = ["owners"], + visibility = ["//visibility:public"], + deps = [ + ":healthcheck__plugin_test_deps", + ], +) for f in glob(["src/test/java/**/*IT.java"])] + java_library( name = "healthcheck__plugin_test_deps", testonly = 1, + srcs = glob(["src/test/java/**/Abstract*.java"]), visibility = ["//visibility:public"], exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [ ":healthcheck__plugin", ], + deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [ + ":healthcheck__plugin", + ], )
diff --git a/src/test/java/com/googlesource/gerrit/plugins/healthcheck/AbstractHealthCheckIntegrationTest.java b/src/test/java/com/googlesource/gerrit/plugins/healthcheck/AbstractHealthCheckIntegrationTest.java index cd3862e..ff924e6 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/healthcheck/AbstractHealthCheckIntegrationTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/healthcheck/AbstractHealthCheckIntegrationTest.java
@@ -26,10 +26,8 @@ import com.googlesource.gerrit.plugins.healthcheck.check.HealthCheckNames; import java.io.IOException; import org.eclipse.jgit.errors.ConfigInvalidException; -import org.junit.Ignore; -@Ignore -public class AbstractHealthCheckIntegrationTest extends LightweightPluginDaemonTest { +class AbstractHealthCheckIntegrationTest extends LightweightPluginDaemonTest { public static class TestModule extends AbstractModule { @Override