Skip to content

Add unit tests for support package #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 34 commits into from

Conversation

Raghul-M
Copy link
Contributor

Issue link

Closes project-codeflare/codeflare-operator#239

What changes have been made

Added Unit test for the Support Package Applicable Modules
Added Workflow file to test the Unit tests

Verification steps

RUN - go test ./support -v

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

Copy link

openshift-ci bot commented Nov 20, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

@Raghul-M
Copy link
Contributor Author

Raghul-M commented Nov 20, 2023

Hey @sutaakar ,

I've added unit tests for Applicable Modules in the Support Package . However, some modules are pending (machine_test.go, and ocm_test.go). I'm currently working on the failed workflow files verify-manifests (pull_request). Due to some issues, some tests are failing, and I'm actively addressing them (specifically in ingress_test.go , ray_test.go).

Feel free to review it.

@Raghul-M Raghul-M requested a review from sutaakar November 20, 2023 08:14
Comment on lines 53 to 60
// testInstance := &T{
// WithT: gomega.NewWithT(t),
// t: t,
// ctx: ctx,
// client: &testClient{
// core: fakeClient,
// },
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I will remove it

Comment on lines 16 to 22
if version != "1.2.3" {
t.Errorf("Expected version 1.2.3, but got %s", version)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In the code above there is used Gomega for assertions.
Can you leverage it also here (and in other places) to keep consistency?

Copy link
Contributor Author

@Raghul-M Raghul-M Nov 21, 2023

Choose a reason for hiding this comment

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

Sure , will do. thanks for the suggestion

"k8s.io/client-go/kubernetes/fake"
)

func NewFakeKubeClientForIngress(objects ...runtime.Object) *fake.Clientset {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems to be same as NewFakeKubeClientWithObjects, IMHO it would be good to reuse the existing one (and possibly move it some dedicated file to keep it on one place independent on specific test files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept this function in a separate file and reused it other files

@@ -9,9 +9,11 @@ require (
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c
github.com/project-codeflare/multi-cluster-app-dispatcher v1.37.0
github.com/ray-project/kuberay/ray-operator v0.0.0-20231016183545-097828931d15
github.com/stretchr/testify v1.8.4
Copy link
Contributor

Choose a reason for hiding this comment

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

What is testify used for?

Copy link
Contributor Author

@Raghul-M Raghul-M Nov 22, 2023

Choose a reason for hiding this comment

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

I missed running go mod tidy . testify It's not needed.

@Raghul-M Raghul-M self-assigned this Nov 28, 2023
@Raghul-M Raghul-M marked this pull request as ready for review January 3, 2024 10:01
@openshift-ci openshift-ci bot requested review from astefanutti and dimakis January 3, 2024 10:01
@Raghul-M Raghul-M force-pushed the unittestsupport#239 branch 2 times, most recently from 6545a72 to 369b325 Compare January 3, 2024 12:31
@Raghul-M
Copy link
Contributor Author

Raghul-M commented Jan 4, 2024

Closing this PR due to Merge Conflicts. So Created New PR with Same changes : New PR

@Raghul-M Raghul-M closed this Jan 4, 2024
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.

Add unit tests for support package
2 participants