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
14 changes: 3 additions & 11 deletions tests/e2e/ambient/ambient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ import (
. "github.com/istio-ecosystem/sail-operator/pkg/test/util/ginkgo"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/cleaner"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/common"
. "github.com/istio-ecosystem/sail-operator/tests/e2e/util/gomega"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -119,22 +117,16 @@ profile: ambient`)
})

It("updates the Istio CR status to Reconciled", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReconciled, metav1.ConditionTrue), "Istio is not Reconciled; unexpected Condition")
Success("Istio CR is Reconciled")
common.AwaitCondition(ctx, v1.IstioConditionReconciled, kube.Key(istioName), &v1.Istio{}, k, cl)
})

It("updates the Istio CR status to Ready", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istio is not Ready; unexpected Condition")
Success("Istio CR is Ready")
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key(istioName), &v1.Istio{}, k, cl)
})

It("deploys istiod", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key("istiod", controlPlaneNamespace), &appsv1.Deployment{}).
Should(HaveConditionStatus(appsv1.DeploymentAvailable, metav1.ConditionTrue), "Istiod is not Available; unexpected Condition")
common.AwaitDeployment(ctx, "istiod", k, cl)
Expect(common.GetVersionFromIstiod()).To(Equal(version.Version), "Unexpected istiod version")
Success("Istiod is deployed in the namespace and Running")
})

It("uses the correct image", func(ctx SpecContext) {
Expand Down
24 changes: 6 additions & 18 deletions tests/e2e/controlplane/control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ import (
. "github.com/istio-ecosystem/sail-operator/pkg/test/util/ginkgo"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/cleaner"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/common"
. "github.com/istio-ecosystem/sail-operator/tests/e2e/util/gomega"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/istioctl"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"istio.io/istio/pkg/ptr"
Expand Down Expand Up @@ -128,15 +126,11 @@ metadata:
})

It("updates the status to Reconciled", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioCniName), &v1.IstioCNI{}).
Should(HaveConditionStatus(v1.IstioCNIConditionReconciled, metav1.ConditionTrue), "IstioCNI is not Reconciled; unexpected Condition")
Success("IstioCNI is Reconciled")
common.AwaitCondition(ctx, v1.IstioCNIConditionReconciled, kube.Key(istioCniName), &v1.IstioCNI{}, k, cl)
})

It("updates the status to Ready", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioCniName), &v1.IstioCNI{}).
Should(HaveConditionStatus(v1.IstioCNIConditionReady, metav1.ConditionTrue), "IstioCNI is not Ready; unexpected Condition")
Success("IstioCNI is Ready")
common.AwaitCondition(ctx, v1.IstioCNIConditionReady, kube.Key(istioCniName), &v1.IstioCNI{}, k, cl)
})

It("doesn't continuously reconcile the IstioCNI CR", func() {
Expand All @@ -152,22 +146,16 @@ metadata:
})

It("updates the Istio CR status to Reconciled", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReconciled, metav1.ConditionTrue), "Istio is not Reconciled; unexpected Condition")
Success("Istio CR is Reconciled")
common.AwaitCondition(ctx, v1.IstioConditionReconciled, kube.Key(istioName), &v1.Istio{}, k, cl)
})

It("updates the Istio CR status to Ready", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istio is not Ready; unexpected Condition")
Success("Istio CR is Ready")
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key(istioName), &v1.Istio{}, k, cl)
})

It("deploys istiod", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key("istiod", controlPlaneNamespace), &appsv1.Deployment{}).
Should(HaveConditionStatus(appsv1.DeploymentAvailable, metav1.ConditionTrue), "Istiod is not Available; unexpected Condition")
common.AwaitDeployment(ctx, "istiod", k, cl)
Expect(common.GetVersionFromIstiod()).To(Equal(version.Version), "Unexpected istiod version")
Success("Istiod is deployed in the namespace and Running")
})

It("uses the correct image", func(ctx SpecContext) {
Expand All @@ -194,7 +182,7 @@ metadata:

samplePods := &corev1.PodList{}
It("updates the pods status to Running", func(ctx SpecContext) {
Eventually(common.CheckPodsReady).WithArguments(ctx, cl, sampleNamespace).Should(Succeed(), "Error checking status of sample pods")
Eventually(common.CheckSamplePodsReady).WithArguments(ctx, cl).Should(Succeed(), "Error checking status of sample pods")
Expect(cl.List(ctx, samplePods, client.InNamespace(sampleNamespace))).To(Succeed(), "Error getting the pods in sample namespace")

Success("sample pods are ready")
Expand Down
22 changes: 5 additions & 17 deletions tests/e2e/controlplane/control_plane_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ var _ = Describe("Control Plane updates", Label("control-plane", "slow"), Ordere
Expect(k.CreateNamespace(istioCniNamespace)).To(Succeed(), "IstioCNI namespace failed to be created")

common.CreateIstioCNI(k, istioversion.Base)
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioCniName), &v1.IstioCNI{}).
Should(HaveConditionStatus(v1.IstioCNIConditionReady, metav1.ConditionTrue), "IstioCNI is not Ready; unexpected Condition")
Success("IstioCNI is Ready")
common.AwaitCondition(ctx, v1.IstioCNIConditionReady, kube.Key(istioCniName), &v1.IstioCNI{}, k, cl)
})

When(fmt.Sprintf("the Istio CR is created with RevisionBased updateStrategy for base version %s", istioversion.Base), func() {
Expand All @@ -75,9 +73,7 @@ updateStrategy:
})

It("deploys istiod and pod is Ready", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key("default"), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istiod is not Available; unexpected Condition")
Success("Istiod is deployed in the namespace and Running")
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key("default"), &v1.Istio{}, k, cl)
})
})

Expand Down Expand Up @@ -124,7 +120,7 @@ spec:
Success("sample deployed")

samplePods := &corev1.PodList{}
Eventually(common.CheckPodsReady).WithArguments(ctx, cl, sampleNamespace).Should(Succeed(), "Error checking status of sample pods")
Eventually(common.CheckSamplePodsReady).WithArguments(ctx, cl).Should(Succeed(), "Error checking status of sample pods")
Expect(cl.List(ctx, samplePods, client.InNamespace(sampleNamespace))).To(Succeed(), "Error getting the pods in sample namespace")

Success("sample pods are ready")
Expand All @@ -138,9 +134,7 @@ spec:
})

It("IstioRevisionTag state change to inUse true", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key("default"), &v1.IstioRevisionTag{}).
Should(HaveConditionStatus(v1.IstioRevisionTagConditionInUse, metav1.ConditionTrue), "unexpected Condition; expected InUse true")
Success("IstioRevisionTag is in use by the sample pods")
common.AwaitCondition(ctx, v1.IstioRevisionTagConditionInUse, kube.Key("default"), &v1.IstioRevisionTag{}, k, cl)
})
})

Expand Down Expand Up @@ -222,13 +216,7 @@ spec:
cl.Delete(ctx, &pod)
}

Expect(cl.List(ctx, samplePods, client.InNamespace(sampleNamespace))).To(Succeed())
Expect(samplePods.Items).ToNot(BeEmpty(), "No pods found in sample namespace")
for _, pod := range samplePods.Items {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(pod.Name, sampleNamespace), &corev1.Pod{}).
Should(HaveConditionStatus(corev1.PodReady, metav1.ConditionTrue), "Pod is not Ready")
}

Eventually(common.CheckSamplePodsReady).WithArguments(ctx, cl).Should(Succeed(), "Error checking status of sample pods")
Success("sample pods restarted and are ready")
})

Expand Down
14 changes: 3 additions & 11 deletions tests/e2e/dualstack/dualstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ import (
. "github.com/istio-ecosystem/sail-operator/pkg/test/util/ginkgo"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/cleaner"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/common"
. "github.com/istio-ecosystem/sail-operator/tests/e2e/util/gomega"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/types"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -99,22 +97,16 @@ values:
})

It("updates the Istio CR status to Reconciled", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReconciled, metav1.ConditionTrue), "Istio is not Reconciled; unexpected Condition")
Success("Istio CR is Reconciled")
common.AwaitCondition(ctx, v1.IstioConditionReconciled, kube.Key(istioName), &v1.Istio{}, k, cl)
})

It("updates the Istio CR status to Ready", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istio is not Ready; unexpected Condition")
Success("Istio CR is Ready")
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key(istioName), &v1.Istio{}, k, cl)
})

It("deploys istiod", func(ctx SpecContext) {
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key("istiod", controlPlaneNamespace), &appsv1.Deployment{}).
Should(HaveConditionStatus(appsv1.DeploymentAvailable, metav1.ConditionTrue), "Istiod is not Available; unexpected Condition")
common.AwaitDeployment(ctx, "istiod", k, cl)
Expect(common.GetVersionFromIstiod()).To(Equal(version.Version), "Unexpected istiod version")
Success("Istiod is deployed in the namespace and Running")
})

It("uses the correct image", func(ctx SpecContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ import (
"github.com/istio-ecosystem/sail-operator/pkg/version"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/cleaner"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/common"
. "github.com/istio-ecosystem/sail-operator/tests/e2e/util/gomega"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/istioctl"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -78,18 +76,12 @@ values:
})

It("updates the default Istio CR status to Ready", func(ctx SpecContext) {
Eventually(common.GetObject).
WithArguments(ctx, clPrimary, kube.Key(istioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istio is not Ready on Cluster #1; unexpected Condition")
Success("Istio CR is Ready on Cluster #1")
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key(istioName), &v1.Istio{}, k1, clPrimary)
})

It("deploys istiod", func(ctx SpecContext) {
Eventually(common.GetObject).
WithArguments(ctx, clPrimary, kube.Key("istiod", controlPlaneNamespace), &appsv1.Deployment{}).
Should(HaveConditionStatus(appsv1.DeploymentAvailable, metav1.ConditionTrue), "Istiod is not Available on Cluster #1; unexpected Condition")
common.AwaitDeployment(ctx, "istiod", k1, clPrimary)
Expect(common.GetVersionFromIstiod()).To(Equal(v.Version), "Unexpected istiod version")
Success("Istiod is deployed in the namespace and Running on Exernal Cluster")
})
})

Expand All @@ -99,11 +91,7 @@ values:
})

It("updates Gateway status to Available", func(ctx SpecContext) {
Eventually(common.GetObject).
WithArguments(ctx, clPrimary, kube.Key("istio-ingressgateway", controlPlaneNamespace), &appsv1.Deployment{}).
Should(HaveConditionStatus(appsv1.DeploymentAvailable, metav1.ConditionTrue), "Gateway is not Ready on Cluster #1; unexpected Condition")

Success("Gateway is created and available in both clusters")
common.AwaitDeployment(ctx, "istio-ingressgateway", k1, clPrimary)
})
})

Expand Down Expand Up @@ -265,11 +253,8 @@ spec:
Expect(k1.CreateFromString(externalControlPlaneYAML)).To(Succeed(), "Istio Resource creation failed on Cluster #1")
})

It("updates both Istio CR status to Ready", func(ctx SpecContext) {
Eventually(common.GetObject).
WithArguments(ctx, clPrimary, kube.Key("external-istiod"), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istio is not Ready on Cluster #1; unexpected Condition")
Success("Istio CR is Ready on Cluster #1")
It("updates external Istio CR status to Ready", func(ctx SpecContext) {
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key("external-istiod"), &v1.Istio{}, k1, clPrimary)
})
})

Expand Down Expand Up @@ -340,10 +325,7 @@ spec:
})

It("updates remote Istio CR status to Ready on Cluster #2", func(ctx SpecContext) {
Eventually(common.GetObject, 10*time.Minute).
WithArguments(ctx, clRemote, kube.Key(externalIstioName), &v1.Istio{}).
Should(HaveConditionStatus(v1.IstioConditionReady, metav1.ConditionTrue), "Istio is not Ready on Remote; unexpected Condition")
Success("Remote Istio CR is Ready on Cluster #2")
common.AwaitCondition(ctx, v1.IstioConditionReady, kube.Key(externalIstioName), &v1.Istio{}, k2, clRemote, 10*time.Minute)
})
})

Expand All @@ -357,20 +339,13 @@ spec:
Success("Sample app is deployed in Cluster #2")
})

samplePodsCluster2 := &corev1.PodList{}
It("updates the pods status to Ready", func(ctx SpecContext) {
Expect(clRemote.List(ctx, samplePodsCluster2, client.InNamespace(sampleNamespace))).To(Succeed())
Expect(samplePodsCluster2.Items).ToNot(BeEmpty(), "No pods found in sample namespace")

for _, pod := range samplePodsCluster2.Items {
Eventually(common.GetObject).
WithArguments(ctx, clRemote, kube.Key(pod.Name, sampleNamespace), &corev1.Pod{}).
Should(HaveConditionStatus(corev1.PodReady, metav1.ConditionTrue), "Pod is not Ready on Cluster #2; unexpected Condition")
}
Eventually(common.CheckSamplePodsReady).WithArguments(ctx, clRemote).Should(Succeed(), "Error checking status of sample pods on Cluster #2")
Success("Sample app is Running")
})

It("has istio.io/rev annotation external-istiod", func(ctx SpecContext) {
samplePodsCluster2 := &corev1.PodList{}
Expect(clRemote.List(ctx, samplePodsCluster2, client.InNamespace(sampleNamespace))).To(Succeed())
Expect(samplePodsCluster2.Items).ToNot(BeEmpty(), "No pods found in sample namespace")

Expand Down
Loading
Loading