Skip to content
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

chore: improve test coverage. #631

Merged
merged 1 commit into from
Sep 22, 2023
Merged

Conversation

jparsai
Copy link
Contributor

@jparsai jparsai commented Aug 28, 2023

Description:

This PR is to cover deleteArgoCDApplicationOfDeletedApplicationRow function, of Cluster-agent component.

JIRA Ticket:

https://issues.redhat.com/browse/GITOPSRVCE-703

@openshift-ci openshift-ci bot requested review from jopit and Rizwana777 August 28, 2023 09:54
@jparsai
Copy link
Contributor Author

jparsai commented Aug 28, 2023

/test managed-gitops-e2e-tests

1 similar comment
@jparsai
Copy link
Contributor Author

jparsai commented Aug 29, 2023

/test managed-gitops-e2e-tests

@jgwest jgwest removed the request for review from jopit August 30, 2023 00:39
@Rizwana777
Copy link
Contributor

@jparsai I think we can cover log errors as well in deleteArgoCDApplicationOfDeletedApplicationRow function by creating mocks similar to this #612 ?

@jparsai
Copy link
Contributor Author

jparsai commented Sep 7, 2023

@jparsai I think we can cover log errors as well in deleteArgoCDApplicationOfDeletedApplicationRow function by creating mocks similar to this #612 ?

That is a good suggestion @Rizwana777, but unfortunately there will be a lot of effort required,
for example here https://github.com/redhat-appstudio/managed-gitops/blob/main/cluster-agent/controllers/managed-gitops/eventloop/operation_event_loop.go#L967
log message will be printed only if I get an error, but there is no way I can cause labels.NewRequirement() to fail without mocking this function as well. If I go with mocking function then it has to be done for many other functions as well.

@Rizwana777
Copy link
Contributor

@jparsai I think we can cover log errors as well in deleteArgoCDApplicationOfDeletedApplicationRow function by creating mocks similar to this #612 ?

That is a good suggestion @Rizwana777, but unfortunately there will be a lot of effort required, for example here https://github.com/redhat-appstudio/managed-gitops/blob/main/cluster-agent/controllers/managed-gitops/eventloop/operation_event_loop.go#L967 log message will be printed only if I get an error, but there is no way I can cause labels.NewRequirement() to fail without mocking this function as well. If I go with mocking function then it has to be done for many other functions as well.

I agree @jparsai thank you

Copy link
Member

@jgwest jgwest left a comment

Choose a reason for hiding this comment

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

Looks great, one final request: can we also verify that the AppProject is deleted, and/or not deleted (exists), for the test cases? (more info on cluster agent appproject behaviour is here if useful).

@jparsai jparsai force-pushed the test-coverage-3 branch 2 times, most recently from 2f94455 to f98ff9f Compare September 19, 2023 11:49
@jparsai
Copy link
Contributor Author

jparsai commented Sep 19, 2023

Looks great, one final request: can we also verify that the AppProject is deleted, and/or not deleted (exists), for the test cases? (more info on cluster agent appproject behaviour is here if useful).

It is done, PTAL.

@jparsai
Copy link
Contributor Author

jparsai commented Sep 19, 2023

/test managed-gitops-e2e-tests

@jparsai
Copy link
Contributor Author

jparsai commented Sep 21, 2023

/test managed-gitops-e2e-tests

Failing in operation_namespace_test.go, which has no changes in this PR, hence triggering once again.

Copy link
Member

@jgwest jgwest left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jparsai!

@openshift-ci openshift-ci bot added the lgtm label Sep 22, 2023
@jgwest jgwest merged commit adb1390 into redhat-appstudio:main Sep 22, 2023
12 checks passed
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgwest, jparsai

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

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

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