Commit 8f5fe60
authored
Fix up unit tests so that gradle correctly reports results (no more erroneous skips) (#1759)
* Remove testng.xml that caused Gradle to report all tests as skipped.
The testng.xml in src/test/resources was auto-discovered by TestNG on the
classpath, causing it to run tests through its own parallel infrastructure
(parallel="methods" thread-count="8") instead of through Gradle's TestListener.
As a result, Gradle never received test completion events and reported all
~19,000 tests as "skipped" with 0 successes, even though they actually ran.
The build.gradle already configures TestNG properly via useTestNG {} blocks
with the correct group inclusions/exclusions, making this file redundant.
* Replace @BeforeTest/@AfterTest with @BeforeMethod/@AfterMethod in most tests.
Without testng.xml, TestNG puts all test classes into a single <test> scope.
A @BeforeTest failure in any class (e.g. HtsgetBAMFileReaderTest trying to
connect to a local htsget server) can cascade to skip every test in the entire
suite — resulting in 19,000+ tests reported as skipped with 0 successes.
* Auto-detect samtools on PATH when HTSJDK_SAMTOOLS_BIN is not set.
SamtoolsTestUtils.getSamtoolsBin() now checks: (1) the HTSJDK_SAMTOOLS_BIN
environment variable, (2) "which samtools" on the system PATH, (3) the
default /usr/local/bin/samtools. This allows tests that depend on samtools
(CRAM31Tests, HtsCRAMCodec31Test, SamtoolsTestUtilsTest) to pass without
requiring the environment variable when samtools is already installed.
* Add "htsget" test group and exclude it from the default test run.
Tests that require a local htsget server (HtsgetBAMFileReaderTest,
HtsgetBAMCodecTest) are now tagged with groups="htsget" and excluded
by default, alongside ftp/http/sra/ena. HTSGET permutations are also
removed from SamReaderFactoryTest's data provider since the dedicated
htsget test classes provide full coverage.
TestNGUtils.getDataProviders() now accepts excluded groups so that
TestDataProviders doesn't try to invoke data providers from classes
that require unavailable external infrastructure.
* Fix thread-safety issues in tests for parallel class execution.
JimFS: Replace hardcoded Jimfs.newFileSystem("test", ...) with
Jimfs.newFileSystem(Configuration.unix()) in 7 test files so concurrent
test classes don't collide on the filesystem name "jimfs://test".
BlockCompressedInputStreamTest: Pass CountingInflaterFactory directly to
each stream constructor instead of setting it as a global default via
BlockGunzipper.setDefaultInflaterFactory(). The global approach caused
flaky failures when other classes concurrently used the same global
InflaterFactory. The test now verifies the same behavior (custom inflater
is used and call count is correct) without touching shared state.
* Switch to TestNG parallel="classes" with 2x CPU threads.
Use TestNG's in-process parallel="classes" instead of Gradle's
maxParallelForks. Unlike parallel="methods" (which breaks Gradle's test
listener), parallel="classes" preserves correct event ordering since
onBeforeClass completes before any onTestStart for that class.
* Fix testExternalApis CI job and remove duplicate testFTP job.
testExternalApis was running ./gradlew testFTP (copy-paste error) instead
of ./gradlew testExternalApis (which runs the sra, http, and ena groups).
The testFTP job was an exact duplicate of the broken testExternalApis job,
both running the same testFTP gradle task. Removed it since the target FTP
site no longer exists.1 parent c6729bb commit 8f5fe60
36 files changed
Lines changed: 140 additions & 147 deletions
File tree
- .github/workflows
- src/test
- java/htsjdk
- beta/codecs
- reads/htsget/HtsgetBAM
- variants/vcf
- samtools
- cram/structure
- filter
- util
- tribble
- index
- interval
- linear
- utils
- variant
- variantcontext/writer
- vcf
- resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 63 | + | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 70 | | |
99 | 71 | | |
100 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
93 | | - | |
| 91 | + | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
| |||
141 | 139 | | |
142 | 140 | | |
143 | 141 | | |
144 | | - | |
| 142 | + | |
145 | 143 | | |
146 | | - | |
| 144 | + | |
147 | 145 | | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | | - | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
0 commit comments