Skip to content

Commit bf474f3

Browse files
committed
Checking Gitrepository resource for the app
1 parent 9d64882 commit bf474f3

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,7 @@ jobs:
377377
- name: Download gitops binary from s3
378378
run: |
379379
mkdir -p cmd/gitops/
380-
# wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-ubuntu-latest
381-
curl -L "https://github.com/weaveworks/weave-gitops/releases/download/v0.4.1/gitops-$(uname)-$(uname -m)" -o gitops-ubuntu-latest
380+
wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-ubuntu-latest
382381
mv gitops-ubuntu-latest $GITOPS_BIN_PATH
383382
- name: Change bin permissions
384383
run: |

test/acceptance/test/cli_upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
156156

157157
return out != ""
158158
}
159-
Eventually(repoExists, ASSERTION_2MINUTE_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeTrue(), fmt.Sprintf("%s/%s Gitrepository does not exist in the cluster", GITOPS_DEFAULT_NAMESPACE, appName))
159+
Eventually(repoExists, ASSERTION_2MINUTE_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeTrue(), fmt.Sprintf("%s/%s Gitrepository resource does not exist in the cluster", GITOPS_DEFAULT_NAMESPACE, appName))
160160

161161
})
162162

test/acceptance/test/pages/applications.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,7 @@ func (a ApplicationDetails) WaitForPageToLoad(webDriver *agouti.Page) {
4444
// This function waits for main application page to be rendered
4545
func (a ApplicationPage) WaitForPageToLoad(webDriver *agouti.Page, appCount int) {
4646
Eventually(a.ApplicationCount).Should(BeVisible())
47-
48-
isLoaded := func() bool {
49-
_ = webDriver.Refresh()
50-
if aCnt, _ := a.ApplicationCount.Text(); aCnt >= strconv.Itoa(appCount) {
51-
return true
52-
}
53-
return false
54-
}
55-
Eventually(isLoaded, 2*time.Minute, 5*time.Second).Should(BeTrue(), "Application page failed to load/render as expected")
47+
Eventually(a.ApplicationCount, 30*time.Second).Should(MatchText(strconv.Itoa(appCount)), "Application page failed to load/render as expected")
5648
}
5749

5850
func GetApplicationPage(webDriver *agouti.Page) *ApplicationPage {

test/acceptance/test/ui_applications.go

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ func DescribeApplications(gitopsTestRunner GitopsTestRunner) {
8686
Expect(string(session.Err.Contents())).Should(BeEmpty())
8787
})
8888

89+
By(fmt.Sprintf("And wait for %s/%s GitRepository resource to be available in cluster", GITOPS_DEFAULT_NAMESPACE, appName), func() {
90+
repoExists := func() bool {
91+
cmd := fmt.Sprintf(`kubectl get GitRepository %s -n %s`, appName, GITOPS_DEFAULT_NAMESPACE)
92+
out, _ := runCommandAndReturnStringOutput(cmd)
93+
94+
return out != ""
95+
}
96+
Eventually(repoExists, ASSERTION_2MINUTE_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeTrue(), fmt.Sprintf("%s/%s Gitrepository resource does not exist in the cluster", GITOPS_DEFAULT_NAMESPACE, appName))
97+
98+
})
99+
89100
pages.NavigateToPage(webDriver, "Applications")
90101
applicationsPage := pages.GetApplicationPage(webDriver)
91102

@@ -106,26 +117,26 @@ func DescribeApplications(gitopsTestRunner GitopsTestRunner) {
106117
By(fmt.Sprintf(`Then %s details should be rendered`, appName), func() {
107118
appDetails.WaitForPageToLoad(webDriver)
108119

109-
Expect(appDetails.Name).Should(MatchText(appName))
110-
Expect(appDetails.DeploymentType).Should(MatchText("Kustomize"))
111-
Expect(appDetails.URL).Should(MatchText(fmt.Sprintf(`ssh://git.+%s/%s.+`, GITHUB_ORG, CLUSTER_REPOSITORY)))
112-
Expect(appDetails.Path).Should(MatchText(appPath))
120+
Eventually(appDetails.Name).Should(MatchText(appName))
121+
Eventually(appDetails.DeploymentType).Should(MatchText("Kustomize"))
122+
Eventually(appDetails.URL).Should(MatchText(fmt.Sprintf(`ssh://git.+%s/%s.+`, GITHUB_ORG, CLUSTER_REPOSITORY)))
123+
Eventually(appDetails.Path).Should(MatchText(appPath))
113124
})
114125

115126
By(fmt.Sprintf(`And %s source/git status is available`, appName), func() {
116127
sourceCondition := pages.GetApplicationConditions(webDriver, "Source Conditions")
117-
Expect(sourceCondition.Type).Should(MatchText("Ready"))
118-
Expect(sourceCondition.Status).Should(MatchText("True"))
119-
Expect(sourceCondition.Reason).Should(MatchText("GitOperationSucceed"))
120-
Expect(sourceCondition.Message).Should(MatchText(`Fetched revision: main/[\w\d].+`))
128+
Eventually(sourceCondition.Type).Should(MatchText("Ready"))
129+
Eventually(sourceCondition.Status).Should(MatchText("True"))
130+
Eventually(sourceCondition.Reason).Should(MatchText("GitOperationSucceed"))
131+
Eventually(sourceCondition.Message).Should(MatchText(`Fetched revision: main/[\w\d].+`))
121132
})
122133

123134
By(fmt.Sprintf(`And %s automation/kustomization status is available`, appName), func() {
124135
sourceCondition := pages.GetApplicationConditions(webDriver, "Automation Conditions")
125-
Expect(sourceCondition.Type).Should(MatchText("Ready"))
126-
Expect(sourceCondition.Status).Should(MatchText("True"))
127-
Expect(sourceCondition.Reason).Should(MatchText("ReconciliationSucceeded"))
128-
Expect(sourceCondition.Message).Should(MatchText(`Applied revision: main/[\w\d].+`))
136+
Eventually(sourceCondition.Type).Should(MatchText("Ready"))
137+
Eventually(sourceCondition.Status, ASSERTION_1MINUTE_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(MatchText("True"))
138+
Eventually(sourceCondition.Reason).Should(MatchText("ReconciliationSucceeded"))
139+
Eventually(sourceCondition.Message).Should(MatchText(`Applied revision: main/[\w\d].+`))
129140
})
130141
})
131142
})

0 commit comments

Comments
 (0)