Skip to content

Conversation

@katushiik11
Copy link
Contributor

@katushiik11 katushiik11 commented Dec 10, 2025

This PR implements tests to improve test coverage in directories controller and insightsclient.

Categories

  • Bugfix
  • Data Enhancement
  • Feature
  • Backporting
  • Others (CI, Infrastructure, Documentation)

Sample Archive

  • None

Documentation

  • None

Unit Tests

  • pkg/controller/kubeconfigs_test.go
  • pkg/controller/operator_test.go
  • pkg/insights/insightsclient/insightsclient_test.go
  • pkg/insights/insightsclient/reader_test.go

Privacy

Yes. There are no sensitive data in the newly collected information.

Changelog

None

Breaking Changes

No

References

https://issues.redhat.com/browse/CCXDEV-15561

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 10, 2025
@openshift-ci
Copy link

openshift-ci bot commented Dec 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: katushiik11

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 10, 2025
@BaiyangZhou
Copy link

/retest

@katushiik11 katushiik11 force-pushed the CCXDEV-15561-test-coverage-2 branch from 9188d16 to 87d6589 Compare December 16, 2025 14:16
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 16, 2025
@katushiik11 katushiik11 changed the title Improve test coverage 2 CCXDEV-15561: Improve test coverage 2 Dec 16, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 16, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Dec 16, 2025

@katushiik11: This pull request references CCXDEV-15561 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

This PR implements tests to improve test coverage in directories controller and insightsclient.

Categories

  • Bugfix
  • Data Enhancement
  • Feature
  • Backporting
  • Others (CI, Infrastructure, Documentation)

Sample Archive

  • None

Documentation

  • None

Unit Tests

  • pkg/controller/kubeconfigs_test.go
  • pkg/controller/operator_test.go
  • pkg/insights/insightsclient/insightsclient_test.go
  • pkg/insights/insightsclient/reader_test.go

Privacy

Yes. There are no sensitive data in the newly collected information.

Changelog

None

Breaking Changes

No

References

https://issues.redhat.com/browse/CCXDEV-15561

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@opokornyy
Copy link
Contributor

/retest

@openshift-ci
Copy link

openshift-ci bot commented Dec 16, 2025

@katushiik11: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

}{
{
name: "storage path already exists",
setupPath: func() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to refactor the inline anonymous functions setupPath and cleanupPath into a helper function and pass arguments to it from the test.

input: "Hello, World! This is a long string.",
limit: 5,
bufferSize: 20,
verifyDetails: func(t *testing.T, lr *LimitedReader, n int, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I think it could be reworked using a boolean flag and adding the assertions directly in the test.

statusCode: http.StatusNotFound,
responseBody: "Not found",
expectError: true,
verifyError: func(t *testing.T, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

name string
includeClusterID bool
param string
verifyPath func(t *testing.T, path string)
Copy link
Contributor

Choose a reason for hiding this comment

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

This case is probably the only one where an anonymous function makes sense, since the body of the function changes.

@opokornyy
Copy link
Contributor

/cc @ncaak

@openshift-ci openshift-ci bot requested a review from ncaak December 18, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants