
One of the main purposes of GerritBaseTests is a place to park the KeyUtil#setEncoderImpl call, which avoids NPEs when calling any gwtorm Key#toString method. Many tests pass today without this base class for one of a few reasons: * They never call Key#toString, or perhaps only call it lazily on test failures. * They transitively load some other class which has setEncoderImpl in its static block, such as Database. * They are run with `bazel test` in the same JVM/classloader as another test class which does inherit GerritBaseTests or otherwise indirectly calls setEncoderImpl. (If any tests exist in this category, then they already fail if run singly in an IDE or with a restricted --test_filter.) In order to avoid having to reason about whether a particular test does or does not depend on setEncoderImpl, just use GerritBaseTests consistently. This will prevent spurious test failures when we start removing classes like Database as we cut out ReviewDb. This change modifies all classes named *Test.java which were not previously inheriting from any base class. Remaining tests will be fixed in followups. Change-Id: I32f5456d2ebc5e545cc89ad65f74139bd3506aaa
37 lines
865 B
Python
37 lines
865 B
Python
load("//tools/bzl:junit.bzl", "junit_tests")
|
|
|
|
MEDIUM_TESTS = ["RefUpdateUtilRepoTest.java"]
|
|
|
|
junit_tests(
|
|
name = "medium_tests",
|
|
size = "medium",
|
|
timeout = "short",
|
|
srcs = MEDIUM_TESTS,
|
|
tags = ["no_windows"],
|
|
deps = [
|
|
"//java/com/google/gerrit/git",
|
|
"//java/com/google/gerrit/testing:gerrit-test-util",
|
|
"//lib:guava",
|
|
"//lib:junit",
|
|
"//lib/jgit/org.eclipse.jgit:jgit",
|
|
"//lib/jgit/org.eclipse.jgit.junit:junit",
|
|
"//lib/truth",
|
|
],
|
|
)
|
|
|
|
junit_tests(
|
|
name = "small_tests",
|
|
size = "small",
|
|
srcs = glob(
|
|
["*.java"],
|
|
exclude = MEDIUM_TESTS,
|
|
),
|
|
deps = [
|
|
"//java/com/google/gerrit/git",
|
|
"//java/com/google/gerrit/testing:gerrit-test-util",
|
|
"//lib:guava",
|
|
"//lib/jgit/org.eclipse.jgit:jgit",
|
|
"//lib/truth",
|
|
],
|
|
)
|