From cb1d2fa5672e52a2562da77ddab7a1cfa96c01d7 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Thu, 25 Apr 2024 16:53:14 +0200 Subject: [PATCH] e2e: simplify emojivoto --- e2e/internal/kuberesource/resourcegen/main.go | 2 +- e2e/internal/kuberesource/sets.go | 50 +------------------ e2e/servicemesh/servicemesh_test.go | 6 ++- 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/e2e/internal/kuberesource/resourcegen/main.go b/e2e/internal/kuberesource/resourcegen/main.go index e4d8713b2..d72841165 100644 --- a/e2e/internal/kuberesource/resourcegen/main.go +++ b/e2e/internal/kuberesource/resourcegen/main.go @@ -42,7 +42,7 @@ func main() { case "openssl": resources, err = kuberesource.OpenSSL() case "emojivoto": - resources, err = kuberesource.Emojivoto() + resources, err = kuberesource.Emojivoto(kuberesource.ServiceMeshDisabled) default: fmt.Printf("Error: unknown set: %s\n", set) os.Exit(1) diff --git a/e2e/internal/kuberesource/sets.go b/e2e/internal/kuberesource/sets.go index 1c449d185..2a2dcd5df 100644 --- a/e2e/internal/kuberesource/sets.go +++ b/e2e/internal/kuberesource/sets.go @@ -233,8 +233,8 @@ func OpenSSL() ([]any, error) { return resources, nil } -// generateEmojivoto returns resources for deploying Emojivoto application. -func generateEmojivoto(smMode serviceMeshMode) ([]any, error) { +// Emojivoto returns resources for deploying Emojivoto application. +func Emojivoto(smMode serviceMeshMode) ([]any, error) { ns := "edg-default" var emojiSvcImage, emojiVotingSvcImage, emojiWebImage, emojiSvcHost, votingSvcHost string smProxyEmoji := ServiceMeshProxy() @@ -645,49 +645,3 @@ func PatchNamespaces(resources []any, namespace string) []any { } return resources } - -// EmojivotoDemo returns patched resources for deploying an Emojivoto demo. -func EmojivotoDemo(replacements map[string]string) ([]any, error) { - resources, err := generateEmojivoto(ServiceMeshDisabled) - if err != nil { - return nil, err - } - patched := PatchImages(resources, replacements) - patched = PatchNamespaces(patched, "default") - return patched, nil -} - -// Emojivoto returns resources for deploying Emojivoto application. -func Emojivoto() ([]any, error) { - resources, err := generateEmojivoto(ServiceMeshDisabled) - if err != nil { - return nil, err - } - - // Add coordinator - ns := "edg-default" - namespace := Namespace(ns) - coordinator := Coordinator(ns).DeploymentApplyConfiguration - coordinatorService := ServiceForDeployment(coordinator) - resources = append(resources, namespace, coordinator, coordinatorService) - - return resources, nil -} - -// EmojivotoIngressEgress returns resources for deploying Emojivoto application with -// the service mesh configured with ingress and egress proxies. -func EmojivotoIngressEgress() ([]any, error) { - resources, err := generateEmojivoto(ServiceMeshIngressEgress) - if err != nil { - return nil, err - } - - // Add coordinator - ns := "edg-default" - namespace := Namespace(ns) - coordinator := Coordinator(ns).DeploymentApplyConfiguration - coordinatorService := ServiceForDeployment(coordinator) - resources = append(resources, namespace, coordinator, coordinatorService) - - return resources, nil -} diff --git a/e2e/servicemesh/servicemesh_test.go b/e2e/servicemesh/servicemesh_test.go index 21d940f95..f3371eadf 100644 --- a/e2e/servicemesh/servicemesh_test.go +++ b/e2e/servicemesh/servicemesh_test.go @@ -30,9 +30,13 @@ var imageReplacements map[string]string func TestIngressEgress(t *testing.T) { ct := contrasttest.New(t, imageReplacements) - resources, err := kuberesource.EmojivotoIngressEgress() + resources, err := kuberesource.Emojivoto(kuberesource.ServiceMeshIngressEgress) require.NoError(t, err) + coordinator := kuberesource.Coordinator("").DeploymentApplyConfiguration + coordinatorService := kuberesource.ServiceForDeployment(coordinator) + resources = append(resources, coordinator, coordinatorService) + ct.Init(t, resources) require.True(t, t.Run("generate", ct.Generate), "contrast generate needs to succeed for subsequent tests")