Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jobs:
TOTP_TOKEN: ${{ secrets.WGE_GITHUB_MFA_KEY }}
DOCKER_IO_USER: ${{ secrets.WGE_DOCKER_IO_USER }}
DOCKER_IO_PASSWORD: ${{ secrets.WGE_DOCKER_IO_PASSWORD }}
EXP_CLUSTER_RESOURCE_SET: true
GITOPS_BIN_PATH: /tmp/gitops
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-${{ matrix.os_name }}-amd64
SELENIUM_DEBUG: true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
TOTP_TOKEN: ${{ secrets.WGE_GITHUB_MFA_KEY }}
DOCKER_IO_USER: ${{ secrets.WGE_DOCKER_IO_USER }}
DOCKER_IO_PASSWORD: ${{ secrets.WGE_DOCKER_IO_PASSWORD }}
EXP_CLUSTER_RESOURCE_SET: true
GITOPS_BIN_PATH: /tmp/gitops
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-${{ matrix.os_name }}-amd64
WGE_ACCEPTANCE_EKS_KUBECONFIG: ${{ secrets.WGE_ACCEPTANCE_EKS_KUBECONFIG }}
Expand Down Expand Up @@ -224,6 +225,7 @@ jobs:
TOTP_TOKEN: ${{ secrets.WGE_GITHUB_MFA_KEY }}
DOCKER_IO_USER: ${{ secrets.WGE_DOCKER_IO_USER }}
DOCKER_IO_PASSWORD: ${{ secrets.WGE_DOCKER_IO_PASSWORD }}
EXP_CLUSTER_RESOURCE_SET: true
GITOPS_BIN_PATH: /tmp/gitops
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-${{ matrix.os_name }}-amd64
WGE_ACCEPTANCE_GCE_KUBECONFIG: ${{ secrets.WGE_ACCEPTANCE_GCE_KUBECONFIG }}
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ jobs:
GITHUB_ORG: ${{ secrets.WGE_GITHUB_ORG }}
GITHUB_USER: ${{ secrets.WGE_GITHUB_USER }}
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
EXP_CLUSTER_RESOURCE_SET: true
GITOPS_BIN_PATH: /tmp/gitops
SELENIUM_DEBUG: true
ACCEPTANCE_TESTS_DATABASE_TYPE: sqlite
Expand Down Expand Up @@ -327,6 +328,7 @@ jobs:
GITHUB_USER: ${{ secrets.WGE_GITHUB_USER }}
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
TOTP_TOKEN: ${{ secrets.WGE_GITHUB_MFA_KEY }}
EXP_CLUSTER_RESOURCE_SET: true
GITOPS_BIN_PATH: /tmp/gitops
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-linux-amd64
SELENIUM_DEBUG: true
Expand All @@ -335,10 +337,6 @@ jobs:
CONNECT_KIND_WKP_LEAF_TEST: true
ARTEFACTS_BASE_DIR: /tmp/workspace/test/
steps:
- name: "Setup dynamic env vars"
run: |
export CLUSTER_REPOSITORY=gitops-capi-template-${{ github.run_id }}-$(openssl rand -hex 8)
echo "CLUSTER_REPOSITORY=$CLUSTER_REPOSITORY" >> $GITHUB_ENV
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
Expand Down Expand Up @@ -408,6 +406,10 @@ jobs:
kubectl get pods -A
- name: Install wego enterprise components on management cluster
run: |
export CLUSTER_REPOSITORY=gitops-capi-template-${{ github.run_id }}-$(openssl rand -hex 8)
# Set the CLUSTER_REPOSITORY as environment variable for subsequent steps
echo "CLUSTER_REPOSITORY=$CLUSTER_REPOSITORY" >> $GITHUB_ENV

./test/utils/scripts/wego-enterprise.sh setup ${{ github.workspace }}
- name: Run acceptance tests
run: |
Expand Down
223 changes: 106 additions & 117 deletions test/acceptance/test/cli_add_delete.go

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions test/acceptance/test/cli_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func DescribeCliGet(gitopsTestRunner GitopsTestRunner) {
capdTemplateCount := 5
totalTemplateCount := awsTemplateCount + eksFargateTemplateCount + capdTemplateCount
By("Apply/Install CAPITemplate", func() {
templateFiles = append(templateFiles, gitopsTestRunner.CreateApplyCapitemplates(5, "capi-server-v1-template-capd.yaml")...)
templateFiles = append(templateFiles, gitopsTestRunner.CreateApplyCapitemplates(5, "capi-template-capd.yaml")...)
templateFiles = append(templateFiles, gitopsTestRunner.CreateApplyCapitemplates(2, "capi-server-v1-template-aws.yaml")...)
templateFiles = append(templateFiles, gitopsTestRunner.CreateApplyCapitemplates(2, "capi-server-v1-template-eks-fargate.yaml")...)
})
Expand Down Expand Up @@ -279,7 +279,7 @@ func DescribeCliGet(gitopsTestRunner GitopsTestRunner) {
It("Verify gitops can list template parameters of a template from template library", func() {

By("Apply/Install CAPITemplate", func() {
templateFiles = gitopsTestRunner.CreateApplyCapitemplates(1, "capi-server-v1-template-capd.yaml")
templateFiles = gitopsTestRunner.CreateApplyCapitemplates(1, "capi-template-capd.yaml")
})

By(fmt.Sprintf("And I run gitops get templates cluster-template-development-0 --list-parameters --endpoint %s", CAPI_ENDPOINT_URL), func() {
Expand All @@ -294,8 +294,7 @@ func DescribeCliGet(gitopsTestRunner GitopsTestRunner) {

By("And I should see parameter rows", func() {
output := session.Wait().Out.Contents()
re := regexp.MustCompile(`CLUSTER_NAME+\s+true\s+This is used for the cluster naming.\s+KUBERNETES_VERSION\s+false\s+Kubernetes version to use for the cluster\s+1.19.7, 1.19.8\s+NAMESPACE\s+false\s+Namespace to create the cluster in`)
Eventually((re.Find(output))).ShouldNot(BeNil())
Eventually(string(output)).Should(MatchRegexp(`CLUSTER_NAME+\s+true\s+This is used for the cluster naming.\s+KUBERNETES_VERSION\s+false\s+Kubernetes version to use for the cluster\s+1.19.11, 1.21.1, 1.22.0, 1.23.0\s+NAMESPACE\s+false\s+Namespace to create the cluster in`))

})
})
Expand Down
81 changes: 73 additions & 8 deletions test/acceptance/test/pages/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import (
type CreateCluster struct {
CreateHeader *agouti.Selection
// TemplateName *agouti.Selection
Credentials *agouti.Selection
TemplateSection *agouti.MultiSelection
PreviewPR *agouti.Selection
Credentials *agouti.Selection
TemplateSection *agouti.MultiSelection
ProfileSelect *agouti.Selection
ProfileSelectPopup *agouti.MultiSelection
PreviewPR *agouti.Selection
}

type FormField struct {
Expand All @@ -28,6 +30,19 @@ type TemplateSection struct {
Fields []FormField
}

type Profile struct {
Name *agouti.Selection
Version *agouti.Selection
Values *agouti.Selection
}

type ValuesYaml struct {
Title *agouti.Selection
Cancel *agouti.Selection
Save *agouti.Selection
TextArea *agouti.Selection
}

type Preview struct {
PreviewLabel *agouti.Selection
PreviewText *agouti.Selection
Expand All @@ -51,9 +66,11 @@ func GetCreateClusterPage(webDriver *agouti.Page) *CreateCluster {
clusterPage := CreateCluster{
CreateHeader: webDriver.Find(`.count-header`),
// TemplateName: webDriver.FindByXPath(`//*/div[text()="Create new cluster with template"]/following-sibling::text()`),
Credentials: webDriver.FindByXPath(`//div[@class="credentials"]//div[contains(@class, "dropdown-toggle")]`),
TemplateSection: webDriver.AllByXPath(`//div[contains(@class, "form-group field field-object")]/child::div`),
PreviewPR: webDriver.FindByButton("Preview PR"),
Credentials: webDriver.FindByXPath(`//div[@class="credentials"]//div[contains(@class, "dropdown-toggle")]`),
TemplateSection: webDriver.AllByXPath(`//div[contains(@class, "form-group field field-object")]/child::div`),
ProfileSelect: webDriver.Find(`div.profiles-select > div`),
ProfileSelectPopup: webDriver.All(`ul[role="listbox"] li`),
PreviewPR: webDriver.FindByButton("Preview PR"),
}

return &clusterPage
Expand Down Expand Up @@ -89,6 +106,50 @@ func (c CreateCluster) GetTemplateSection(webdriver *agouti.Page, sectionName st
Fields: formFields,
}
}

func GetProfile(webDriver *agouti.Page, profileName string) Profile {
fields := webDriver.All("div.MuiBox-root ul li")
pCnt, _ := fields.Count()
for i := 0; i < pCnt; i++ {
pName, _ := fields.At(i).Find(`div.profile-name`).Text()
if profileName == pName {
return Profile{
Name: fields.At(i).Find(`div.profile-name`),
Version: fields.At(i).Find(`div.profile-version`),
Values: fields.At(i).Find(`button`),
}
}
}
return Profile{}
}

func GetValuesYaml(webDriver *agouti.Page) ValuesYaml {
Eventually(webDriver.Find(`div.MuiDialogTitle-root`)).Should(BeVisible())
return ValuesYaml{
Title: webDriver.Find(`div.MuiDialogTitle-root > h5`),
Cancel: webDriver.Find(`div.MuiDialogTitle-root > button`),
TextArea: webDriver.FindByXPath(`//div[@class="MuiDialogContent-root"]/textarea[1]`),
Save: webDriver.Find(`button#edit-yaml`),
}
}

func (c CreateCluster) SelectProfile(profileName string) *agouti.Selection {
time.Sleep(2 * time.Second)
pCount, _ := c.ProfileSelectPopup.Count()

for i := 0; i < pCount; i++ {
pName, _ := c.ProfileSelectPopup.At(i).Text()
if profileName == pName {
return c.ProfileSelectPopup.At(i)
}
}
return nil
}

func DissmissProfilePopup(webDriver *agouti.Page) {
Expect(webDriver.Find(`div[name=Profiles]`).DoubleClick()).To(Succeed())
}

func GetCredentials(webDriver *agouti.Page) *agouti.MultiSelection {
return webDriver.All(`div.dropdown-item`)
}
Expand All @@ -97,8 +158,12 @@ func GetCredential(webDriver *agouti.Page, value string) *agouti.Selection {
return webDriver.Find(fmt.Sprintf(`div.dropdown-item[title*="%s"]`, value))
}

func GetParameterOption(webDriver *agouti.Page, value string) *agouti.Selection {
return webDriver.Find(fmt.Sprintf(`li[data-value="%s"]`, value))
func GetOption(webDriver *agouti.Page, sectionType string, value string) *agouti.Selection {
if sectionType == "profile" {
return webDriver.FindByXPath(fmt.Sprintf(`//div[.="%s"]`, value))
} else {
return webDriver.Find(fmt.Sprintf(`li[data-value="%s"]`, value))
}
}

func GetPreview(webDriver *agouti.Page) Preview {
Expand Down
20 changes: 17 additions & 3 deletions test/acceptance/test/ui_applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,21 @@ func DescribeApplications(gitopsTestRunner GitopsTestRunner) {
Eventually(addApp.GitCredentials).Should(BeVisible())
}
addApp = pages.GetAddApplicationForm(webDriver)
Expect(addApp.Submit.Click()).To(Succeed())
// workaround when simple 'Submit' button click fails to trigger add application event
if pages.ElementExist(addApp.Submit) {
clickSubmit := func() bool {
err := addApp.Submit.Click()
if err == nil {
visible, _ := addApp.Submit.Visible()
return !visible
}
return false
}
Eventually(clickSubmit).Should(BeTrue(), "Failed to click application add Submit button")
} else {
Fail("Can't find the submit button on application page")
}

pages.WaitForAuthenticationAlert(webDriver, "Application added successfully!")
Expect(addApp.ViewApplication.Click()).To(Succeed())
})
Expand All @@ -163,8 +177,8 @@ func DescribeApplications(gitopsTestRunner GitopsTestRunner) {
})

By("And I should see workload is deployed to the cluster", func() {
Expect(waitForResource("deploy", appName, appNamespace, ASSERTION_5MINUTE_TIME_OUT)).To(Succeed())
Expect(waitForResource("pods", "", appNamespace, ASSERTION_5MINUTE_TIME_OUT)).To(Succeed())
Expect(waitForResource("deploy", appName, appNamespace, "", ASSERTION_5MINUTE_TIME_OUT)).To(Succeed())
Expect(waitForResource("pods", "", appNamespace, "", ASSERTION_5MINUTE_TIME_OUT)).To(Succeed())
command := exec.Command("sh", "-c", fmt.Sprintf("kubectl wait --for=condition=Ready --timeout=60s -n %s --all pods --selector='app!=wego-app'", appNamespace))
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
Expect(err).ShouldNot(HaveOccurred())
Expand Down
Loading