Skip to content

[FLINK-40375] Fix kube-apiserver and mock-server tests silently skipped in CI - #1177

Merged
gyfora merged 1 commit into
apache:mainfrom
spuru9:FLINK-40375-kubeapiserver-tests
Aug 13, 2026
Merged

[FLINK-40375] Fix kube-apiserver and mock-server tests silently skipped in CI#1177
gyfora merged 1 commit into
apache:mainfrom
spuru9:FLINK-40375-kubeapiserver-tests

Conversation

@spuru9

@spuru9 spuru9 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Five test classes report Tests run: 0 while the build passes, so 10 test methods
contribute no coverage. This fixes the underlying failures and makes such failures
fail the build instead of passing silently.

The cause is not a binary download failure — the download succeeds and extraction
then fails. Two independent problems compound:

1. Binary extraction crashes. flink-kubernetes-operator-api declares
commons-io:2.17.0 directly, which by Maven's nearest-definition rule overrides the
2.20.0 that commons-compress:1.28.0 (pulled in by io.fabric8:kube-api-test) is
built against:

java.lang.IllegalAccessError: class org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
tried to access protected method 'java.io.InputStream org.apache.commons.io.build.AbstractStreamBuilder.getInputStream()'
	at org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream.<init>(GzipCompressorInputStream.java:265)
	at io.fabric8.kubeapitest.binary.BinaryDownloader.extractFiles(BinaryDownloader.java:94)
	at io.fabric8.kubeapitest.junit.KubeAPIServerExtension.beforeAll(KubeAPIServerExtension.java:48)

This only reproduces on a cold ~/.kubeapitest cache, which is why it appears on CI
runners but not on developer machines with a warm cache.

2. The failure is swallowed. Both failures occur in beforeAll, and
maven-surefire-plugin 3.0.0-M4 discards those — fixed in 3.0.0-M5
(SUREFIRE-1741, of which
SUREFIRE-1688 is a duplicate).
The surefire XML report contains no error record at all.

Bumping surefire then turned the build red on two further classes with the same
suppressed-beforeAll pattern but a different cause: kubernetes-server-mock
declares kubernetes-client as <optional>true</optional> so it is not inherited
transitively, and flink-kubernetes-standalone only has the fabric8 client shaded
into flink-kubernetes. Its mock-server tests failed with
NoClassDefFoundError: io/fabric8/kubernetes/api/model/HasMetadata. Supplying the
unshaded client then surfaced a second layer, since kubernetes-client is managed
with every httpclient implementation excluded. Both were pre-existing — confirmed
reporting Tests run: 0 on surefire 3.0.0-M4.

Brief change log

  • Bump maven-surefire-plugin from 3.0.0-M4 to 3.5.6 so beforeAll failures fail the build
  • Bump commons-io from 2.17.0 to 2.22.0 (latest stable in the major), with a comment recording the constraint
  • Add unshaded io.fabric8:kubernetes-client and an httpclient implementation at test scope to flink-kubernetes-standalone
  • Update the operator NOTICE for the bundled commons-io version

maven-failsafe-plugin needs no change — it is already on 3.0.0-M5, which contains the fix.

Verifying this change

Verified locally with a cold ~/.kubeapitest cache and all quality checks enabled.

Before (at the previous base commit), the build was green while running 2718 tests,
with these classes silently at Tests run: 0:

Test class Before After
FlinkConfigurationYamlSupportTest 0 1
EventUtilsApiServerTest 0 2
FlinkOperatorTest 0 2
KubernetesStandaloneClusterDescriptorTest 0 3
Fabric8FlinkStandaloneKubeClientTest 0 2

mvn clean install now passes and runs 10 more tests than before. Reverting only the
commons-io bump correctly produces BUILD FAILURE (exit 1) rather than
Tests run: 0 + BUILD SUCCESS, confirming the failure is no longer silent.

Note: ScalingExecutorTest also reports Tests run: 0 because its @Nested class is
credited with the full count. That is a reporting artifact present identically on both
surefire versions, not a skipped test, and is unaffected by this change.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): yescommons-io 2.17.0 -> 2.22.0 (bundled, NOTICE updated); two test-scope dependencies added to flink-kubernetes-standalone; maven-surefire-plugin 3.0.0-M4 -> 3.5.6
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • Core observer or reconciler logic that is regularly executed: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@Dennis-Mircea Dennis-Mircea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR, that's a good catch! The new pom comments are a bit more verbose than they need to be, but other than that, it looks good.

@spuru9

spuru9 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Before:

[INFO] Running org.apache.flink.kubernetes.operator.kubeclient.Fabric8FlinkStandaloneKubeClientTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.flink.kubernetes.operator.kubeclient.Fabric8FlinkStandaloneKubeClientTest

[INFO] Running org.apache.flink.kubernetes.operator.standalone.KubernetesStandaloneClusterDescriptorTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in org.apache.flink.kubernetes.operator.standalone.KubernetesStandaloneClusterDescriptorTest

[INFO] Running org.apache.flink.kubernetes.operator.api.FlinkConfigurationYamlSupportTest
2026-08-12 13:43:42,584 i.f.k.b.BinaryDownloader       [INFO ] Downloading binaries with version: 1.36.2
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.805 s - in org.apache.flink.kubernetes.operator.api.FlinkConfigurationYamlSupportTest

[INFO] Running org.apache.flink.kubernetes.operator.utils.EventUtilsApiServerTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 s - in org.apache.flink.kubernetes.operator.utils.EventUtilsApiServerTest

[INFO] Running org.apache.flink.kubernetes.operator.FlinkOperatorTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in org.apache.flink.kubernetes.operator.FlinkOperatorTest

@spuru9

spuru9 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

After

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.157 s -- in org.apache.flink.kubernetes.operator.kubeclient.Fabric8FlinkStandaloneKubeClientTest

 [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.640 s -- in org.apache.flink.kubernetes.operator.standalone.KubernetesStandaloneClusterDescriptorTest

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.62 s -- in org.apache.flink.kubernetes.operator.api.FlinkConfigurationYamlSupportTest

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.942 s -- in org.apache.flink.kubernetes.operator.utils.EventUtilsApiServerTest

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.188 s -- in org.apache.flink.kubernetes.operator.FlinkOperatorTest

Five test classes reported "Tests run: 0" while the build stayed green,
leaving 10 test methods without coverage.

Two independent problems compounded:

- flink-kubernetes-operator-api declared commons-io 2.17.0 directly, which
  by nearest-definition overrode the 2.20.0 that commons-compress 1.28.0
  (via io.fabric8:kube-api-test) is built against. The binary download
  succeeded and extraction then failed with an IllegalAccessError in
  GzipCompressorInputStream. This only reproduces on a cold
  ~/.kubeapitest cache, which is why it showed on CI runners only.

- kubernetes-server-mock declares kubernetes-client as optional, so it is
  not inherited transitively. flink-kubernetes-standalone only has the
  fabric8 client shaded into flink-kubernetes, so the mock server
  extension failed with NoClassDefFoundError: HasMetadata.

Both failures happen in beforeAll, and surefire 3.0.0-M4 discards those
(fixed in 3.0.0-M5), so nothing was recorded in the surefire report.

Bump surefire to 3.5.6 so such failures fail the build, bump commons-io to
2.22.0, and add the unshaded kubernetes-client plus an httpclient
implementation at test scope to flink-kubernetes-standalone.

This recovers 10 test methods across five classes:
FlinkConfigurationYamlSupportTest (1), EventUtilsApiServerTest (2),
FlinkOperatorTest (2), KubernetesStandaloneClusterDescriptorTest (3) and
Fabric8FlinkStandaloneKubeClientTest (2).
@spuru9
spuru9 force-pushed the FLINK-40375-kubeapiserver-tests branch from 2ed1219 to d841210 Compare August 12, 2026 19:05
@spuru9

spuru9 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

CI passed earlier
image

Have made comments precise as per the review from @Dennis-Mircea

@spuru9
spuru9 requested a review from Dennis-Mircea August 12, 2026 19:07
@gyfora
gyfora merged commit 163497a into apache:main Aug 13, 2026
130 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants