Skip to content

Commit

Permalink
e2e tests for validating Ambient deployment (#541)
Browse files Browse the repository at this point in the history
* e2e tests for validating Ambient deployment

This PR implements e2e tests for control plane and dataplane validation
of Ambient profile in the Sail Operator.

Related to: #500
Signed-off-by: Sridhar Gaddam <[email protected]>

* Fix flaky error seen while running tests

As part of the test framework, when istio and istio-cni namespaces are
deleted, we were not waiting until the namespaces are deleted. Because
of this, we were seeing some race conditions in subsequent tests. This
PR fixes it.

Signed-off-by: Sridhar Gaddam <[email protected]>

* Verify ztunnel listening sockets in the application pod ns

Signed-off-by: Sridhar Gaddam <[email protected]>

* Avoid platform while running the e2e tests

Signed-off-by: Sridhar Gaddam <[email protected]>

---------

Signed-off-by: Sridhar Gaddam <[email protected]>
  • Loading branch information
sridhargaddam authored Jan 16, 2025
1 parent 8957638 commit 4e9cf6a
Show file tree
Hide file tree
Showing 4 changed files with 443 additions and 2 deletions.
66 changes: 66 additions & 0 deletions tests/e2e/ambient/ambient_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//go:build e2e

// Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package ambient

import (
"testing"

k8sclient "github.com/istio-ecosystem/sail-operator/tests/e2e/util/client"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/common"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/env"
"github.com/istio-ecosystem/sail-operator/tests/e2e/util/kubectl"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client"
)

var (
cl client.Client
err error
operatorNamespace = common.OperatorNamespace
deploymentName = env.Get("DEPLOYMENT_NAME", "sail-operator")
controlPlaneNamespace = env.Get("CONTROL_PLANE_NS", "istio-system")
istioName = env.Get("ISTIO_NAME", "default")
istioCniNamespace = env.Get("ISTIOCNI_NAMESPACE", "istio-cni")
ztunnelNamespace = env.Get("ZTUNNEL_NAMESPACE", "ztunnel")
istioCniName = env.Get("ISTIOCNI_NAME", "default")
skipDeploy = env.GetBool("SKIP_DEPLOY", false)
expectedRegistry = env.Get("EXPECTED_REGISTRY", "^docker\\.io|^gcr\\.io")
multicluster = env.GetBool("MULTICLUSTER", false)

k kubectl.Kubectl
)

func TestAmbient(t *testing.T) {
if multicluster {
t.Skip("Skipping the Ambient tests")
}

RegisterFailHandler(Fail)
setup()
RunSpecs(t, "Ambient Test Suite")
}

func setup() {
GinkgoWriter.Println("************ Running Setup ************")

GinkgoWriter.Println("Initializing k8s client")
cl, err = k8sclient.InitK8sClient("")
Expect(err).NotTo(HaveOccurred())

k = kubectl.New("clAmbient")
}
Loading

0 comments on commit 4e9cf6a

Please sign in to comment.