From d5182ca269d85c0f99f48d383d1a3b2e07f5bfa6 Mon Sep 17 00:00:00 2001 From: Suraj Deshmukh Date: Fri, 3 Jul 2020 19:57:56 +0530 Subject: [PATCH] istio-operator: Add e2e test - Adds e2e test to verify if pods are up and running. - Adds test to verify if the metrics are scraped. Signed-off-by: Suraj Deshmukh --- test/components/istio/istio_test.go | 57 ++++++++++++++++++++++ test/monitoring/components_metrics_test.go | 5 ++ 2 files changed, 62 insertions(+) create mode 100644 test/components/istio/istio_test.go diff --git a/test/components/istio/istio_test.go b/test/components/istio/istio_test.go new file mode 100644 index 000000000..68342a40e --- /dev/null +++ b/test/components/istio/istio_test.go @@ -0,0 +1,57 @@ +// Copyright 2020 The Lokomotive 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. + +// +build aws aks aws_edge packet +// +build e2e + +package istio_test + +import ( + "testing" + "time" + + testutil "github.com/kinvolk/lokomotive/test/components/util" +) + +const ( + retryInterval = 3 * time.Second + timeout = 7 * time.Minute +) + +func TestIstioDeployments(t *testing.T) { + deployments := []struct { + Namespace string + Deployment string + }{ + { + Namespace: "istio-operator", + Deployment: "istio-operator", + }, + { + Namespace: "istio-system", + Deployment: "istiod", + }, + } + + client := testutil.CreateKubeClient(t) + + for _, d := range deployments { + d := d + t.Run(d.Deployment, func(t *testing.T) { + t.Parallel() + + testutil.WaitForDeployment(t, client, d.Namespace, d.Deployment, retryInterval, timeout) + }) + } +} diff --git a/test/monitoring/components_metrics_test.go b/test/monitoring/components_metrics_test.go index d5d46a2e7..72a6f01ae 100644 --- a/test/monitoring/components_metrics_test.go +++ b/test/monitoring/components_metrics_test.go @@ -90,6 +90,11 @@ func testComponentsPrometheusMetrics(t *testing.T, v1api v1.API) { query: "certmanager_controller_sync_call_count", platforms: []testutil.Platform{testutil.PlatformPacket, testutil.PlatformAWS, testutil.PlatformAKS}, }, + { + componentName: "experimental-istio-operator", + query: "pilot_k8s_reg_events", + platforms: []testutil.Platform{testutil.PlatformPacket, testutil.PlatformAWS, testutil.PlatformAKS}, + }, } for _, tc := range testCases {