From 7125b66473b82e7cb9ad4f9747b573ef460d5724 Mon Sep 17 00:00:00 2001 From: Martin Gencur Date: Tue, 24 Aug 2021 09:41:46 +0200 Subject: [PATCH 1/2] TestServiceExport works with images specified by digest --- test/e2e/service_export_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/e2e/service_export_test.go b/test/e2e/service_export_test.go index 7725a84754..d9901e761b 100644 --- a/test/e2e/service_export_test.go +++ b/test/e2e/service_export_test.go @@ -55,11 +55,16 @@ func TestServiceExport(t *testing.T) { t.Log("create service with byo revision") serviceCreateWithOptions(r, "hello", "--revision-name", "rev1") + userImage := pkgtest.ImagePath("helloworld") + if strings.Contains(userImage, "@") { + // Images specified by digest are not set in user-image annotation. + userImage = "" + } t.Log("export service-revision1 and compare") serviceExport(r, "hello", test.BuildServiceWithOptions("hello", servingtest.WithConfigSpec(test.BuildConfigurationSpec()), servingtest.WithBYORevisionName("hello-rev1"), - test.WithRevisionAnnotations(map[string]string{"client.knative.dev/user-image": pkgtest.ImagePath("helloworld")}), + test.WithRevisionAnnotations(map[string]string{"client.knative.dev/user-image": userImage}), ), "--mode", "replay", "-o", "json") t.Log("update service - add env variable") @@ -97,7 +102,7 @@ func TestServiceExport(t *testing.T) { servingtest.WithConfigSpec(test.BuildConfigurationSpec()), servingtest.WithBYORevisionName("hello-rev1"), test.WithRevisionAnnotations(map[string]string{ - "client.knative.dev/user-image": pkgtest.ImagePath("helloworld"), + "client.knative.dev/user-image": userImage, "serving.knative.dev/routes": "hello", }), )), @@ -117,7 +122,7 @@ func TestServiceExport(t *testing.T) { servingtest.WithEnv(corev1.EnvVar{Name: "a", Value: "mouse"}), ), test.BuildKNExportWithOptions( test.WithKNRevision(*(test.BuildRevision("hello-rev1", - servingtest.WithRevisionAnn("client.knative.dev/user-image", pkgtest.ImagePath("helloworld")), + servingtest.WithRevisionAnn("client.knative.dev/user-image", userImage), servingtest.WithRevisionAnn("serving.knative.dev/routes", "hello"), servingtest.WithRevisionLabel("serving.knative.dev/configuration", "hello"), servingtest.WithRevisionLabel("serving.knative.dev/configurationGeneration", "1"), @@ -136,7 +141,7 @@ func TestServiceExport(t *testing.T) { test.WithService(test.BuildServiceWithOptions("hello", servingtest.WithConfigSpec(test.BuildConfigurationSpec()), test.WithRevisionAnnotations(map[string]string{ - "client.knative.dev/user-image": pkgtest.ImagePath("helloworld"), + "client.knative.dev/user-image": userImage, "serving.knative.dev/routes": "hello", }), servingtest.WithBYORevisionName("hello-rev1"), @@ -167,7 +172,7 @@ func TestServiceExport(t *testing.T) { servingtest.WithEnv(corev1.EnvVar{Name: "a", Value: "mouse"}, corev1.EnvVar{Name: "b", Value: "cat"}), ), test.BuildKNExportWithOptions( test.WithKNRevision(*(test.BuildRevision("hello-rev1", - servingtest.WithRevisionAnn("client.knative.dev/user-image", pkgtest.ImagePath("helloworld")), + servingtest.WithRevisionAnn("client.knative.dev/user-image", userImage), servingtest.WithRevisionAnn("serving.knative.dev/routes", "hello"), servingtest.WithRevisionLabel("serving.knative.dev/configuration", "hello"), servingtest.WithRevisionLabel("serving.knative.dev/configurationGeneration", "1"), From 11cc35a5c1e78891e24e9ffbd0b0a39a1aa08365 Mon Sep 17 00:00:00 2001 From: Martin Gencur Date: Tue, 24 Aug 2021 11:31:04 +0200 Subject: [PATCH 2/2] Do not expect image name in TestSourceContainer test * it might not be available if the test image is passed as image digest --- test/e2e/source_container_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/source_container_test.go b/test/e2e/source_container_test.go index 7c98035e7c..5481486133 100644 --- a/test/e2e/source_container_test.go +++ b/test/e2e/source_container_test.go @@ -81,7 +81,7 @@ func containerSourceList(r *test.KnRunResultCollector, containerSources ...strin r.AssertNoError(out) assert.Check(r.T(), util.ContainsAll(out.Stdout, "NAME", "IMAGE", "SINK", "READY")) assert.Check(r.T(), util.ContainsAll(out.Stdout, containerSources...)) - assert.Check(r.T(), util.ContainsAll(out.Stdout, "grpc-ping", "ksvc:testsvc0")) + assert.Check(r.T(), util.ContainsAll(out.Stdout, "ksvc:testsvc0")) } func containerSourceCreateMissingSink(r *test.KnRunResultCollector, sourceName string, sink string) {