Skip to content

Add embedded test for streaming logs of cancelled task#18580

Merged
kfaraz merged 10 commits intoapache:masterfrom
kfaraz:add_k8s_cancel_test
Sep 29, 2025
Merged

Add embedded test for streaming logs of cancelled task#18580
kfaraz merged 10 commits intoapache:masterfrom
kfaraz:add_k8s_cancel_test

Conversation

@kfaraz
Copy link
Copy Markdown
Contributor

@kfaraz kfaraz commented Sep 26, 2025

Description

Changes:

  • Add embedded test to verify streaming logs of a cancelled task in all environments

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@capistrant capistrant self-requested a review September 27, 2025 02:52
Copy link
Copy Markdown
Contributor

@capistrant capistrant left a comment

Choose a reason for hiding this comment

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

+1 pending green CI!

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Sep 27, 2025

The KubernetesWithClusterOperatorDockerTest failed if we remove the invocation of startWatchingLogs() from KubernetesWorkItem.shutdown().

https://github.com/apache/druid/actions/runs/18058444959/job/51392286069?pr=18580#step:9:8155

Trying the test once with the original code.

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Sep 28, 2025

The KubernetesClusterWithOperatorDockerTest succeeded with the original code.

@capistrant , it seems that we can't get rid of the invocation of startWatchingLogs() in KubernetesWorkItem.shutdown().
I haven't dug very deep but it is most likely because
KubernetesWorkItem.shutdown() calls KubernetesPeonLifecycle.shutdown()
which calls kubernetesClient.deletePeonJob(taskId).

After this, join() calls startWatchingLogs() but it fails to initialize logWatch since the peon job is already deleted.

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Sep 28, 2025

I have triggered another run to confirm this.

@capistrant
Copy link
Copy Markdown
Contributor

capistrant commented Sep 28, 2025

The KubernetesClusterWithOperatorDockerTest succeeded with the original code.

@capistrant , it seems that we can't get rid of the invocation of startWatchingLogs() in KubernetesWorkItem.shutdown(). I haven't dug very deep but it is most likely because KubernetesWorkItem.shutdown() calls KubernetesPeonLifecycle.shutdown() which calls kubernetesClient.deletePeonJob(taskId).

After this, join() calls startWatchingLogs() but it fails to initialize logWatch since the peon job is already deleted.

Damn ok. #18556 did upgrade fabric8 to 7.4.0 which attempts to address the bug that is seemingly behind the LogWatch issues (fabric8io/kubernetes-client#7163) so maybe it isn't huge deal if this bug is actually fixed in fabric8

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Sep 29, 2025

Damn ok. #18556 did upgrade fabric8 to 7.4.0 which attempts to address the bug that is seemingly behind the LogWatch issues (fabric8io/kubernetes-client#7163) so maybe it isn't huge deal if this bug is actually fixed in fabric8

Yeah, let's hope the issue doesn't happen after the upgrade.

I will merge this PR off once the CI is green since the test is still useful.

The embedded test flakiness encountered here is being addressed in #18583

@kfaraz kfaraz merged commit 44a5d70 into apache:master Sep 29, 2025
158 of 160 checks passed
@kfaraz kfaraz deleted the add_k8s_cancel_test branch September 29, 2025 03:38
@cecemei cecemei added this to the 35.0.0 milestone Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants