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

Use mocks for ApplicationSet Gitea, GitHub, and GitLab unit tests #9287

Closed
crenshaw-dev opened this issue May 3, 2022 · 5 comments · Fixed by #9305 or #9400
Closed

Use mocks for ApplicationSet Gitea, GitHub, and GitLab unit tests #9287

crenshaw-dev opened this issue May 3, 2022 · 5 comments · Fixed by #9305 or #9400
Assignees
Labels
component:application-sets Bulk application management related component:test Test requests (e2e or unit) enhancement New feature or request

Comments

@crenshaw-dev
Copy link
Member

Summary

The Gitea unit tests for the PR and SCM generators currently make external API calls. This makes the tests flaky. We should instead use a mocked service.

https://github.com/argoproj/argo-cd/blob/master/applicationset/services/scm_provider/gitea_test.go
https://github.com/argoproj/argo-cd/blob/master/applicationset/services/pull_request/gitea_test.go

Motivation

Last week integration tests were broken for a couple days because of a change in the tested Gitea org.

Proposal

We could follow the model of the Bitbucket tests and use a mocked service.

func defaultHandler(t *testing.T) func(http.ResponseWriter, *http.Request) {

@crenshaw-dev crenshaw-dev added enhancement New feature or request component:application-sets Bulk application management related component:test Test requests (e2e or unit) labels May 3, 2022
@ashutosh16
Copy link
Contributor

@crenshaw-dev Can you assign the issue to me? thx!

@rishabh625
Copy link
Contributor

Lets include github and gitlab mock too with this issue
@ashutosh16 : I am raising PR for github and gitlab , i hopw u worked for gitea only

@rishabh625
Copy link
Contributor

rishabh625 commented May 5, 2022

@crenshaw-dev : can u please assign to me as well, as github supports multiple asignee and edit title as well

@crenshaw-dev crenshaw-dev changed the title Use mocks for ApplicationSet Gitea unit tests Use mocks for ApplicationSet Gitea, GitHub, and GitLab unit tests May 5, 2022
@rishabh625
Copy link
Contributor

@ashutosh16 : any update for gitea change?

@crenshaw-dev
Copy link
Member Author

Reopened for gitea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:application-sets Bulk application management related component:test Test requests (e2e or unit) enhancement New feature or request
Projects
None yet
3 participants