From e2a009aec248290c6b08d15e6ff9a1d26076be9d Mon Sep 17 00:00:00 2001 From: aattuluri Date: Mon, 30 Sep 2024 11:38:16 -0700 Subject: [PATCH] Fix broken tests --- admiral/pkg/controller/admiral/job_test.go | 4 +++- admiral/pkg/controller/admiral/monovertex_test.go | 4 +++- admiral/pkg/controller/admiral/vertex_test.go | 4 +++- install/sample/sample_dep.yaml | 8 ++++---- tests/run.sh | 3 --- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/admiral/pkg/controller/admiral/job_test.go b/admiral/pkg/controller/admiral/job_test.go index 7a8cf69e..00797f7f 100644 --- a/admiral/pkg/controller/admiral/job_test.go +++ b/admiral/pkg/controller/admiral/job_test.go @@ -58,6 +58,8 @@ func TestJobController_Added(t *testing.T) { Cache: &cache, } job := getJob("job-ns", map[string]string{"sidecar.istio.io/inject": "true", "admiral.io/env": "dev"}, map[string]string{"identity": "job", "istio-injected": "true"}) + expectedJob := getK8sObjectFromJob(job) + expectedJob.Status = common.ProcessingInProgress jobWithBadLabels := getJob("jobWithBadLabels-ns", map[string]string{"admiral.io/env": "dev"}, map[string]string{"identity": "jobWithBadLabels", "random-label": "true"}) jobWithIgnoreLabels := getJob("jobWithIgnoreLabels-ns", map[string]string{"sidecar.istio.io/inject": "true", "admiral.io/env": "dev"}, map[string]string{"identity": "jobWithIgnoreLabels", "istio-injected": "true", "admiral-ignore": "true"}) jobWithIgnoreAnnotations := getJob("jobWithIgnoreAnnotations-ns", map[string]string{"admiral.io/ignore": "true"}, map[string]string{"identity": "jobWithIgnoreAnnotations"}) @@ -73,7 +75,7 @@ func TestJobController_Added(t *testing.T) { { name: "Expects job to be added to the cache when the correct label is present", job: job, - expectedJob: getK8sObjectFromJob(job), + expectedJob: expectedJob, id: "job", expectedCacheContains: true, }, diff --git a/admiral/pkg/controller/admiral/monovertex_test.go b/admiral/pkg/controller/admiral/monovertex_test.go index 4148754a..7d097f6c 100644 --- a/admiral/pkg/controller/admiral/monovertex_test.go +++ b/admiral/pkg/controller/admiral/monovertex_test.go @@ -55,6 +55,8 @@ func TestMonoVertexController_Added(t *testing.T) { Cache: &cache, } monomonoVertex := getMonoVertex("monomonoVertex-ns", map[string]string{"sidecar.istio.io/inject": "true", "admiral.io/env": "dev"}, map[string]string{"identity": "monomonoVertex", "istio-injected": "true"}) + expectedMonoVertex := getK8sObjectFromMonoVertex(monomonoVertex) + expectedMonoVertex.Status = common.ProcessingInProgress monomonoVertexWithBadLabels := getMonoVertex("monomonoVertexWithBadLabels-ns", map[string]string{"admiral.io/env": "dev"}, map[string]string{"identity": "monomonoVertexWithBadLabels", "random-label": "true"}) monomonoVertexWithIgnoreLabels := getMonoVertex("monomonoVertexWithIgnoreLabels-ns", map[string]string{"sidecar.istio.io/inject": "true", "admiral.io/env": "dev"}, map[string]string{"identity": "monomonoVertexWithIgnoreLabels", "istio-injected": "true", "admiral-ignore": "true"}) monomonoVertexWithIgnoreAnnotations := getMonoVertex("monomonoVertexWithIgnoreAnnotations-ns", map[string]string{"admiral.io/ignore": "true"}, map[string]string{"identity": "monomonoVertexWithIgnoreAnnotations"}) @@ -70,7 +72,7 @@ func TestMonoVertexController_Added(t *testing.T) { { name: "Expects monomonoVertex to be added to the cache when the correct label is present", monomonoVertex: monomonoVertex, - expectedMonoVertex: getK8sObjectFromMonoVertex(monomonoVertex), + expectedMonoVertex: expectedMonoVertex, id: "monomonoVertex", expectedCacheContains: true, }, diff --git a/admiral/pkg/controller/admiral/vertex_test.go b/admiral/pkg/controller/admiral/vertex_test.go index cb27a2a7..1d49b864 100644 --- a/admiral/pkg/controller/admiral/vertex_test.go +++ b/admiral/pkg/controller/admiral/vertex_test.go @@ -55,6 +55,8 @@ func TestVertexController_Added(t *testing.T) { Cache: &cache, } vertex := getVertex("vertex-ns", map[string]string{"sidecar.istio.io/inject": "true", "admiral.io/env": "dev"}, map[string]string{"identity": "vertex", "istio-injected": "true"}) + expectedVertex := getK8sObjectFromVertex(vertex) + expectedVertex.Status = common.ProcessingInProgress vertexWithBadLabels := getVertex("vertexWithBadLabels-ns", map[string]string{"admiral.io/env": "dev"}, map[string]string{"identity": "vertexWithBadLabels", "random-label": "true"}) vertexWithIgnoreLabels := getVertex("vertexWithIgnoreLabels-ns", map[string]string{"sidecar.istio.io/inject": "true", "admiral.io/env": "dev"}, map[string]string{"identity": "vertexWithIgnoreLabels", "istio-injected": "true", "admiral-ignore": "true"}) vertexWithIgnoreAnnotations := getVertex("vertexWithIgnoreAnnotations-ns", map[string]string{"admiral.io/ignore": "true"}, map[string]string{"identity": "vertexWithIgnoreAnnotations"}) @@ -70,7 +72,7 @@ func TestVertexController_Added(t *testing.T) { { name: "Expects vertex to be added to the cache when the correct label is present", vertex: vertex, - expectedVertex: getK8sObjectFromVertex(vertex), + expectedVertex: expectedVertex, id: "vertex", expectedCacheContains: true, }, diff --git a/install/sample/sample_dep.yaml b/install/sample/sample_dep.yaml index aff08a96..086c1f9f 100644 --- a/install/sample/sample_dep.yaml +++ b/install/sample/sample_dep.yaml @@ -2,7 +2,7 @@ apiVersion: admiral.io/v1alpha1 kind: Dependency metadata: - name: dependency + name: dependency-webapp namespace: admiral spec: source: webapp @@ -29,7 +29,7 @@ spec: apiVersion: admiral.io/v1alpha1 kind: Dependency metadata: - name: dependency + name: dependency-greeeting namespace: admiral spec: source: greeting @@ -41,7 +41,7 @@ spec: apiVersion: admiral.io/v1alpha1 kind: Dependency metadata: - name: dependency + name: dependency-job namespace: admiral spec: source: job @@ -53,7 +53,7 @@ spec: apiVersion: admiral.io/v1alpha1 kind: Dependency metadata: - name: dependency + name: dependency-monovertex namespace: admiral spec: source: monovertex diff --git a/tests/run.sh b/tests/run.sh index ec1354d0..3de4e796 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -34,9 +34,6 @@ sleep 10 ./test5.sh "webapp" "sample-rollout-bluegreen" "greeting.bluegreen" ./test2.sh "webapp" "sample-rollout-canary" "greeting.canary" -# Test Proxy VirtualService Call -./test7.sh "webapp" "sample" "stage.httpbin.foo" - #cleanup to fee up the pipeline minkube resources if [[ $IS_LOCAL == "false" ]]; then kubectl scale --replicas=0 deploy webapp -n sample