From 32d90a37647d2b60c2cc3f3c3b8a6679ada5e5e4 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Wed, 26 May 2021 15:33:34 -0600 Subject: [PATCH 1/4] fix deploy --- .github/workflows/deploy.yml | 6 ++-- test/acceptance/test/core_operations_test.go | 31 ++++++++------------ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 542511db38..2876a362d7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,8 +1,8 @@ on: push: - branches: - - main - workflow_dispatch: + # branches: + # - main + # workflow_dispatch: name: Deploy jobs: diff --git a/test/acceptance/test/core_operations_test.go b/test/acceptance/test/core_operations_test.go index 427258cc9e..6488ba1727 100644 --- a/test/acceptance/test/core_operations_test.go +++ b/test/acceptance/test/core_operations_test.go @@ -19,11 +19,8 @@ import ( "github.com/fluxcd/go-git-providers/gitprovider" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/onsi/gomega/gbytes" "github.com/onsi/gomega/gexec" "github.com/prometheus/common/log" - "github.com/weaveworks/weave-gitops/pkg/cmdimpl" - "github.com/weaveworks/weave-gitops/pkg/flux" "github.com/weaveworks/weave-gitops/pkg/fluxops" "github.com/weaveworks/weave-gitops/pkg/status" "github.com/weaveworks/weave-gitops/pkg/utils" @@ -89,7 +86,13 @@ var _ = Describe("WEGO Acceptance Tests", func() { Expect(setupTest()).Should(Succeed()) Expect(ensureWegoRepoIsAbsent()).Should(Succeed()) Expect(ensureFluxVersion()).Should(Succeed()) - Expect(installWego()).Should(Succeed()) + + //Install wego + command := exec.Command("sh", "-c", fmt.Sprintf("%s install | kubectl apply -f -", WEGO_BIN_PATH)) + session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter) + Expect(err).ShouldNot(HaveOccurred()) + Eventually(session).Should(gexec.Exit()) + Expect(waitForFluxInstall()).Should(Succeed()) Expect(setUpTestRepo()).Should(Succeed()) }) @@ -119,8 +122,8 @@ var _ = Describe("WEGO Acceptance Tests", func() { By("kubectl get pods -n wego-system should list the source and kustomize controllers", func() { Expect(waitForNginxDeployment()).Should(Succeed()) Expect(runCommandForGinkgo("kubectl get pods -n wego-system")).Should(Succeed()) - Eventually(session).Should(gbytes.Say("kustomize-controller")) - Eventually(session).Should(gbytes.Say("source-controller")) + Eventually(string(session.Wait().Out.Contents())).Should(ContainSubstring("kustomize-controller")) + Eventually(string(session.Wait().Out.Contents())).Should(ContainSubstring("source-controller")) }) }) @@ -147,8 +150,8 @@ var _ = Describe("WEGO Acceptance Tests", func() { By("kubectl get pods -n wego-system should list the source and kustomize controllers", func() { Expect(waitForNginxDeployment()).Should(Succeed()) Expect(runCommandForGinkgo("kubectl get pods -n wego-system")).Should(Succeed()) - Eventually(session).Should(gbytes.Say("kustomize-controller")) - Eventually(session).Should(gbytes.Say("source-controller")) + Eventually(string(session.Wait().Out.Contents())).Should(ContainSubstring("kustomize-controller")) + Eventually(string(session.Wait().Out.Contents())).Should(ContainSubstring("source-controller")) }) }) }) @@ -273,7 +276,8 @@ func waitForNginxDeployment() error { func waitForFluxInstall() error { for i := 1; i < 11; i++ { log.Infof("Waiting for flux... try: %d of 10\n", i) - if status.GetClusterStatus() == status.FluxInstalled { + err := utils.CallCommandForEffectWithDebug("kubectl get customresourcedefinition buckets.source.toolkit.fluxcd.io") + if err == nil { return nil } time.Sleep(5 * time.Second) @@ -281,15 +285,6 @@ func waitForFluxInstall() error { return fmt.Errorf("Failed to install flux") } -func installWego() error { - flux.SetupFluxBin() - manifests, err := cmdimpl.Install(cmdimpl.InstallParamSet{Namespace: "wego-system"}) - if err != nil { - return err - } - return utils.CallCommandForEffectWithInputPipeAndDebug("kubectl apply -f -", string(manifests)) -} - func getWegoRepoName() (string, error) { return fluxops.GetRepoName() } From 8380d31030c0f4b62f7cfe9b00329f69ab8892e0 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Wed, 26 May 2021 15:53:15 -0600 Subject: [PATCH 2/4] test --- test/acceptance/test/smoke_tests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acceptance/test/smoke_tests.go b/test/acceptance/test/smoke_tests.go index 67e4af82cb..b0c93c1ee1 100644 --- a/test/acceptance/test/smoke_tests.go +++ b/test/acceptance/test/smoke_tests.go @@ -63,7 +63,7 @@ var _ = Describe("WEGO Smoke Tests", func() { }) By("And branch name", func() { - Eventually(session).Should(gbytes.Say("Branch: main|HEAD\n")) + // Eventually(session).Should(gbytes.Say("Branch: main|HEAD\n")) }) }) From 98cd401fcfe8c0851def1cbbaa22901ab662f5d6 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Wed, 26 May 2021 16:03:47 -0600 Subject: [PATCH 3/4] remove flux check --- test/acceptance/test/core_operations_test.go | 22 -------------------- 1 file changed, 22 deletions(-) diff --git a/test/acceptance/test/core_operations_test.go b/test/acceptance/test/core_operations_test.go index 6488ba1727..f819304344 100644 --- a/test/acceptance/test/core_operations_test.go +++ b/test/acceptance/test/core_operations_test.go @@ -12,7 +12,6 @@ import ( "os" "os/exec" "path/filepath" - "strings" "time" "github.com/fluxcd/go-git-providers/github" @@ -24,7 +23,6 @@ import ( "github.com/weaveworks/weave-gitops/pkg/fluxops" "github.com/weaveworks/weave-gitops/pkg/status" "github.com/weaveworks/weave-gitops/pkg/utils" - "github.com/weaveworks/weave-gitops/pkg/version" ) const nginxDeployment = `apiVersion: v1 @@ -85,7 +83,6 @@ var _ = Describe("WEGO Acceptance Tests", func() { By("Setup test", func() { Expect(setupTest()).Should(Succeed()) Expect(ensureWegoRepoIsAbsent()).Should(Succeed()) - Expect(ensureFluxVersion()).Should(Succeed()) //Install wego command := exec.Command("sh", "-c", fmt.Sprintf("%s install | kubectl apply -f -", WEGO_BIN_PATH)) @@ -242,25 +239,6 @@ func ensureWegoRepoAccess() (*gitprovider.RepositoryVisibility, error) { return nil, fmt.Errorf("wepo does not exist") } -func ensureFluxVersion() error { - if version.FluxVersion == "undefined" { - tomlpath, err := filepath.Abs("../../../tools/bin/stoml") - if err != nil { - return err - } - deppath, err := filepath.Abs("../../../tools/dependencies.toml") - if err != nil { - return err - } - out, err := utils.CallCommandSilently(fmt.Sprintf("%s %s flux.version", tomlpath, deppath)) - if err != nil { - return err - } - version.FluxVersion = strings.TrimRight(string(out), "\n") - } - return nil -} - func waitForNginxDeployment() error { for i := 1; i < 61; i++ { log.Infof("Waiting for nginx... try: %d of 60\n", i) From 2877a0c8799bad31a2a89ec9a971f44be8c4b850 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Wed, 26 May 2021 16:18:22 -0600 Subject: [PATCH 4/4] revert change for test --- .github/workflows/deploy.yml | 6 +++--- test/acceptance/test/smoke_tests.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2876a362d7..542511db38 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,8 +1,8 @@ on: push: - # branches: - # - main - # workflow_dispatch: + branches: + - main + workflow_dispatch: name: Deploy jobs: diff --git a/test/acceptance/test/smoke_tests.go b/test/acceptance/test/smoke_tests.go index b0c93c1ee1..67e4af82cb 100644 --- a/test/acceptance/test/smoke_tests.go +++ b/test/acceptance/test/smoke_tests.go @@ -63,7 +63,7 @@ var _ = Describe("WEGO Smoke Tests", func() { }) By("And branch name", func() { - // Eventually(session).Should(gbytes.Say("Branch: main|HEAD\n")) + Eventually(session).Should(gbytes.Say("Branch: main|HEAD\n")) }) })