Skip to content

feat(test): Add integration tests for status server#3373

Open
digvijay-y wants to merge 3 commits intokubeflow:masterfrom
digvijay-y:test-Server
Open

feat(test): Add integration tests for status server#3373
digvijay-y wants to merge 3 commits intokubeflow:masterfrom
digvijay-y:test-Server

Conversation

@digvijay-y
Copy link
Copy Markdown

What this PR does / why we need it:
Adds integration tests for the status server handleTrainJobRuntimeStatus handler.

The tests include coverage of:

  • The happy path (updating the train job status)
  • invalid data is rejected with a useful error message progressPercentage greater than 100 +kubebuilder:validation:Minimum=0 and +kubebuilder:validation:Maximum=100 with this handler would return 422
  • updating a non-existing trainjob is rejected with a useful error message

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):
Fixes #3346

Checklist:

  • Docs included if any changes are user facing

Signed-off-by: DIGVIJAY <144053736+digvijay-y@users.noreply.github.com>
Signed-off-by: DIGVIJAY <144053736+digvijay-y@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 22, 2026 14:31
@github-actions
Copy link
Copy Markdown

🎉 Welcome to the Kubeflow Trainer! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.
  • Our team will review your PR soon! cc @kubeflow/kubeflow-trainer-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign electronic-waste for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@digvijay-y digvijay-y changed the title feat(Tests): Add integration tests for status server feat(test): Add integration tests for status server Mar 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Ginkgo integration coverage for the status server’s handleTrainJobRuntimeStatus endpoint, exercising real API-server validation behavior in the envtest-based integration suite.

Changes:

  • Introduces a new integration spec that boots a TLS-enabled status server and posts status updates against it.
  • Covers success, invalid payload validation (e.g., progressPercentage > 100), and not-found TrainJob updates.

Comment on lines +156 to +160
httpClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec // test only
},
}
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

The http.Client here has no per-request timeout, and the custom http.Transport will use the default ~30s dial timeout, so a stalled connect can block longer than the Eventually window and slow/hang the suite; set httpClient.Timeout (and/or transport dial/handshake timeouts) to a small value for tests.

Copilot uses AI. Check for mistakes.
Comment on lines +150 to +153
go func() {
defer ginkgo.GinkgoRecover()
_ = server.Start(serverCtx)
}()
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

The goroutine running server.Start ignores its returned error, which can turn bind/TLS failures into a later timeout with no useful signal; capture the error via a channel (and fail the spec immediately) so startup issues are surfaced deterministically.

Copilot uses AI. Check for mistakes.
Signed-off-by: DIGVIJAY <144053736+digvijay-y@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add integration tests for status server

2 participants