diff --git a/test/acceptance/test/core_operations_test.go b/test/acceptance/test/core_operations_test.go index 427258cc9e..f819304344 100644 --- a/test/acceptance/test/core_operations_test.go +++ b/test/acceptance/test/core_operations_test.go @@ -12,22 +12,17 @@ import ( "os" "os/exec" "path/filepath" - "strings" "time" "github.com/fluxcd/go-git-providers/github" "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" - "github.com/weaveworks/weave-gitops/pkg/version" ) const nginxDeployment = `apiVersion: v1 @@ -88,8 +83,13 @@ var _ = Describe("WEGO Acceptance Tests", func() { By("Setup test", 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 +119,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 +147,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")) }) }) }) @@ -239,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) @@ -273,7 +254,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 +263,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() }