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

Add integration test coverage for adding an app in a GitLab repo #1101

Merged
merged 10 commits into from
Dec 1, 2021

Conversation

jpellizzari
Copy link
Contributor

@jpellizzari jpellizzari commented Nov 18, 2021

Adds some much needed test coverage for GitLab. Only covers the Merge Request case (not auto-merge).

These tests have reached a tipping point IMO and need to be refactored into a table-style test to reduce some of the repetition. I will handle that in another PR, as getting the coverage is more important than making them DRY.

@jpellizzari jpellizzari force-pushed the jp-gitlab-support branch 3 times, most recently from e2ca5bd to 4d7c523 Compare November 22, 2021 23:00
@jpellizzari jpellizzari changed the title Jp gitlab support Add integration test coverage for adding an app in a GitLab repo Nov 23, 2021
@jpellizzari jpellizzari marked this pull request as ready for review November 23, 2021 23:19
Copy link
Contributor

@josecordaz josecordaz left a comment

Choose a reason for hiding this comment

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

LGTM just some thoughts

@@ -58,7 +58,7 @@ func CreateRepo(ctx context.Context, gp gitprovider.Client, url string) (gitprov
return nil, nil, fmt.Errorf("could not reconcile org repo: %w", err)
}

err = utils.WaitUntil(os.Stdout, 3*time.Second, 9*time.Second, func() error {
err = utils.WaitUntil(bytes.NewBuffer([]byte{}), 3*time.Second, 9*time.Second, func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious on why came back to this. Last time, we agreed to print to stdout to have better debug logs. Any change of mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes I should have called this out.

Logging to stdout during the retry loop populates the output with unnecessary information. We expect the retry to fire a couple of times, so we don't need to tell the user about it.

It ensures that we only log things when they have gone wrong. If the WaitUntil function hides important output or doesn't return an error at the right time, there is a bug with WaitUntil.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, are you suggesting printing out all errors only if the last attempt fails?

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 see, are you suggesting printing out all errors only if the last attempt fails?

I am suggesting only printing the error if waitUntil returns one.

test/integration/server/helpers/fetcher.go Outdated Show resolved Hide resolved
test/integration/server/helpers/fetcher.go Show resolved Hide resolved
test/integration/server/helpers/fetcher.go Outdated Show resolved Hide resolved
Copy link
Contributor

@luizbafilho luizbafilho 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, just a minor nit

test/integration/server/add_test.go Outdated Show resolved Hide resolved
@jpellizzari jpellizzari deleted the jp-gitlab-support branch December 1, 2021 22:37
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.

None yet

3 participants