Skip to content

Commit

Permalink
chore(e2e): wait for the catalog to be ready
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Jun 22, 2023
1 parent 560ebc7 commit 1f01fba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
5 changes: 1 addition & 4 deletions e2e/commonwithcustominstall/operator_id_filtering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ package commonwithcustominstall
import (
"fmt"
"os"
"strings"
"testing"
"time"

Expand All @@ -36,7 +35,6 @@ import (

. "github.com/apache/camel-k/v2/e2e/support"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/openshift"
)

Expand All @@ -45,8 +43,7 @@ func TestOperatorIDCamelCatalogReconciliation(t *testing.T) {
operator1 := "operator-1"
Expect(KamelInstallWithID(operator1, ns, "--global", "--force").Execute()).To(Succeed())
Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
catalogName := fmt.Sprintf("camel-catalog-%s", strings.ToLower(defaults.DefaultRuntimeVersion))
Eventually(CamelCatalogPhase(ns, catalogName), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
Eventually(DefaultCamelCatalogPhase(ns), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
})
}

Expand Down
5 changes: 3 additions & 2 deletions e2e/install/cli/uninstall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ package cli

import (
"fmt"
"testing"

. "github.com/onsi/gomega"
"testing"

. "github.com/apache/camel-k/v2/e2e/support"
"github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/util/olm"
)

Expand All @@ -38,6 +38,7 @@ func TestBasicUninstall(t *testing.T) {
operatorID := fmt.Sprintf("camel-k-%s", ns)
Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
Eventually(DefaultCamelCatalogPhase(ns), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))

// should be completely removed on uninstall
Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles").Execute()).To(Succeed())
Expand Down
3 changes: 3 additions & 0 deletions e2e/install/upgrade/cli_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func TestCLIOperatorUpgrade(t *testing.T) {
// Check the operator pod is running
Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
// Check the IntegrationPlatform has been reconciled
Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
Eventually(PlatformVersion(ns), TestTimeoutMedium).Should(Equal(defaults.Version))

// Check the Integration hasn't been upgraded
Expand All @@ -99,6 +100,8 @@ func TestCLIOperatorUpgrade(t *testing.T) {
// Force the Integration upgrade
Expect(Kamel("rebuild", name, "-n", ns).Execute()).To(Succeed())

// A catalog should be created with the new configuration
Eventually(DefaultCamelCatalogPhase(ns), TestTimeoutMedium).Should(Equal(v1.CamelCatalogPhaseReady))
// Check the Integration version has been upgraded
Eventually(IntegrationVersion(ns, name), TestTimeoutMedium).Should(Equal(defaults.Version))

Expand Down
11 changes: 11 additions & 0 deletions e2e/support/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,17 @@ func DeleteCamelCatalog(ns, name string) func() bool {
}
}

func DefaultCamelCatalogPhase(ns string) func() v1.CamelCatalogPhase {
return func() v1.CamelCatalogPhase {
catalogName := fmt.Sprintf("camel-catalog-%s", strings.ToLower(defaults.DefaultRuntimeVersion))
c := CamelCatalog(ns, catalogName)()
if c == nil {
return ""
}
return c.Status.Phase
}
}

func CamelCatalogPhase(ns, name string) func() v1.CamelCatalogPhase {
return func() v1.CamelCatalogPhase {
c := CamelCatalog(ns, name)()
Expand Down

0 comments on commit 1f01fba

Please sign in to comment.