@@ -87,6 +87,11 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
87
87
// Create vanilla cluster for WGE upgrade
88
88
CreateCluster ("kind" , kind_upgrade_cluster_name , "upgrade-kind-config.yaml" )
89
89
90
+ By ("And cluster repo does not already exist" , func () {
91
+ gitopsTestRunner .DeleteRepo (CLUSTER_REPOSITORY )
92
+ _ = deleteDirectory ([]string {path .Join ("/tmp" , CLUSTER_REPOSITORY )})
93
+ })
94
+
90
95
})
91
96
92
97
JustAfterEach (func () {
@@ -106,53 +111,53 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
106
111
107
112
It ("@upgrade Verify wego core can be upgraded to wego enterprise" , func () {
108
113
109
- By ("When I install gitops/wego to my active cluster" , func () {
110
- InstallAndVerifyGitops (GITOPS_DEFAULT_NAMESPACE )
111
- })
112
-
113
- By ("And I install profile controllers to my active cluster" , func () {
114
- InstallAndVerifyPctl (GITOPS_DEFAULT_NAMESPACE )
115
- })
116
-
117
- By ("And cluster repo does not already exist" , func () {
118
- gitopsTestRunner .DeleteRepo (CLUSTER_REPOSITORY )
119
- _ = deleteDirectory ([]string {path .Join ("/tmp" , CLUSTER_REPOSITORY )})
120
- })
121
-
122
114
By ("When I create a private repository for cluster configs" , func () {
123
115
repoAbsolutePath = gitopsTestRunner .InitAndCreateEmptyRepo (CLUSTER_REPOSITORY , true )
124
116
testFile := createTestFile ("README.md" , "# gitops-capi-template" )
125
117
126
118
gitopsTestRunner .GitAddCommitPush (repoAbsolutePath , testFile )
127
119
})
128
120
121
+ By ("When I install gitops/wego to my active cluster" , func () {
122
+ InstallAndVerifyGitops (GITOPS_DEFAULT_NAMESPACE , GetGitRepositoryURL (repoAbsolutePath ))
123
+ })
124
+
125
+ By ("And I install profile controllers to my active cluster" , func () {
126
+ InstallAndVerifyPctl (GITOPS_DEFAULT_NAMESPACE )
127
+ })
128
+
129
129
addCommand := fmt .Sprintf ("add app . --path=./%s --name=%s --auto-merge=true" , appPath , appName )
130
130
By (fmt .Sprintf ("And I run gitops add app command ' %s 'in namespace %s from dir %s" , addCommand , GITOPS_DEFAULT_NAMESPACE , repoAbsolutePath ), func () {
131
- command := exec .Command ("sh" , "-c" , fmt .Sprintf ("cd %s && %s %s" , repoAbsolutePath , GITOPS_BIN_PATH , addCommand ))
132
- session , err = gexec .Start (command , GinkgoWriter , GinkgoWriter )
133
- Expect (err ).ShouldNot (HaveOccurred ())
134
- Eventually (session ).Should (gexec .Exit ())
135
- Expect (string (session .Err .Contents ())).Should (BeEmpty ())
131
+ cmd := fmt .Sprintf ("cd %s && %s %s" , repoAbsolutePath , GITOPS_BIN_PATH , addCommand )
132
+ _ , err := runCommandAndReturnStringOutput (cmd )
133
+ Expect (err ).Should (BeEmpty ())
136
134
})
137
135
138
136
By ("And I install the entitlement for cluster upgrade" , func () {
139
137
Expect (gitopsTestRunner .KubectlApply ([]string {}, "../../utils/scripts/entitlement-secret.yaml" ), "Failed to create/configure entitlement" )
140
138
})
141
139
142
140
By ("And I install the git repository secret for cluster service" , func () {
143
- command := exec .Command ("sh" , "-c" , fmt .Sprintf (`kubectl create secret generic git-provider-credentials --namespace=%s --from-literal="GIT_PROVIDER_TOKEN=%s"` , GITOPS_DEFAULT_NAMESPACE , GITHUB_TOKEN ))
144
- session , err = gexec .Start (command , GinkgoWriter , GinkgoWriter )
145
- Expect (err ).ShouldNot (HaveOccurred ())
146
- Eventually (session , ASSERTION_2MINUTE_TIME_OUT ).Should (gexec .Exit ())
147
- Expect (string (session .Err .Contents ())).Should (BeEmpty (), "Failed to create git repository secret for cluster service" )
141
+ cmd := fmt .Sprintf (`kubectl create secret generic git-provider-credentials --namespace=%s --from-literal="GIT_PROVIDER_TOKEN=%s"` , GITOPS_DEFAULT_NAMESPACE , GITHUB_TOKEN )
142
+ _ , err := runCommandAndReturnStringOutput (cmd )
143
+ Expect (err ).Should (BeEmpty (), "Failed to create git repository secret for cluster service" )
148
144
})
149
145
150
146
By ("And I install the docker registry secret for wego enteprise components" , func () {
151
- command := exec .Command ("sh" , "-c" , fmt .Sprintf (`kubectl create secret docker-registry docker-io-pull-secret --namespace=%s --docker-username=%s --docker-password=%s` , GITOPS_DEFAULT_NAMESPACE , DOCKER_IO_USER , DOCKER_IO_PASSWORD ))
152
- session , err = gexec .Start (command , GinkgoWriter , GinkgoWriter )
153
- Expect (err ).ShouldNot (HaveOccurred ())
154
- Eventually (session , ASSERTION_2MINUTE_TIME_OUT ).Should (gexec .Exit ())
155
- Expect (string (session .Err .Contents ())).Should (BeEmpty (), "Failed to create git repository secret for cluster service" )
147
+ cmd := fmt .Sprintf (`kubectl create secret docker-registry docker-io-pull-secret --namespace=%s --docker-username=%s --docker-password=%s` , GITOPS_DEFAULT_NAMESPACE , DOCKER_IO_USER , DOCKER_IO_PASSWORD )
148
+ _ , err := runCommandAndReturnStringOutput (cmd )
149
+ Expect (err ).Should (BeEmpty (), "Failed to create git repository secret for cluster service" )
150
+ })
151
+
152
+ By (fmt .Sprintf ("And wait for %s/%s GitRepository resource to be available in cluster" , GITOPS_DEFAULT_NAMESPACE , appName ), func () {
153
+ repoExists := func () bool {
154
+ cmd := fmt .Sprintf (`kubectl get GitRepository %s -n %s` , appName , GITOPS_DEFAULT_NAMESPACE )
155
+ out , _ := runCommandAndReturnStringOutput (cmd )
156
+
157
+ return out != ""
158
+ }
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 ))
160
+
156
161
})
157
162
158
163
prBranch := "wego-upgrade-enterprise"
0 commit comments