-
Notifications
You must be signed in to change notification settings - Fork 142
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
Fix nightly tests and refactor add tests #1286
Conversation
@@ -1211,7 +1221,9 @@ var _ = Describe("Weave GitOps Add App Tests", func() { | |||
}) | |||
|
|||
By("And repo created has private visibility", func() { | |||
Eventually(getGitRepoVisibility(githubOrg, appRepoName, gitproviders.GitProviderGitHub)).Should(ContainSubstring("private")) | |||
if os.Getenv("GIT_PROVIDER") != "gitlab" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we need else
cases in all the places we have this validation. I ask because there is an else
in line 1728.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this validation when we run tests on gitlab repos; this validation fails for gitlab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we are not going to cover the gitlab case in this moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context:
This PR was originally opened to enable test runs in gitlab repos. However, the tests couldn't be run on parallel since we have standing clusters and that would create conflict(and failures). So I tried running the tests one after another. First the acceptance tests would run on github, then on gitlab. This worked but it took ridiculously long to run: https://github.com/weaveworks/weave-gitops/actions/runs/1721328971 (almost 4 hrs!!)
Nightly tests are famously hard to fix because of the long runtime and adding more time is not ideal.
Fix:
So, for now, I've refactored stuff to get the nightly passing and I've configured the nightly to run Mon-Sat. I have a plan to write up another job that will run every week on Sun that will cover the entire github/gitlab workflow. This seemed like a reasonable bargain — run time-consuming tests weekly instead of daily.
To answer your original question — no, we don't need an else
for all the if
conditions. Because for line 1728
, we have different outcomes depending on github/gitlab repos and both outcomes need to be verified. For RepoVisibility
check, however, we only need this to work when GIT_PROVIDER
is NOT gitlab
. Otherwise, it will just run as is. And the default behavior pretty much in every workflow is to use github
.
@josecordaz Hope this answers your question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rokshana-b Sorry probably I'm not making myself understood. It's just that it seems weird to me that we have a By
clause saying And repo created has private visibility
, and when I see this if os.Getenv("GIT_PROVIDER") != "gitlab" {
it tells that we are not going to check the visibility of the repo for gitlab. But what is still not clear to me is "why". You mentioned we only need this to work when GIT_PROVIDER is NOT gitlab
but this doesn't explain why. What is even stranger for me is that we are using go-git-providers in function getGitRepoVisibility
which in theory should handle both types of providers. At this point I wonder if the "why" is a bug in the go-git-providers repo. If this fails for gitlab what would be the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josecordaz I wanted to leave a msg for you in this PR so its documented. There's no real bug here. The problem is for github, the repo visibility is either private
or public
— simple as that. For gitlab, however, the repo visibility depends on the group
. So, everytime we create a private repo for github, it should work for gitlab. But if we create a public repo for github, the same will not be true for gitlab. If the gitlab-repo-group is private, the repo visibility will remain private.
The failures I saw were related to github being a public
repo and gitlab remaining as private
. It was probably overkill for me to disable repo visibility checks for all gitlab tests. I will re-add the checks wherever the github repos are private
in another PR.
@rokshana-b I see you removed env var
|
@josecordaz I removed the K8S version from nightly because we the clusters have fixed versions and they need to be changed manually from the console. So we don't need to re-add it |
What changed?
How did you test it?