From 3cd3f602d862040398055a552605345015d1f274 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Fri, 8 Mar 2024 11:43:12 +0100 Subject: [PATCH] e2e: call set from e2e test --- .github/workflows/e2e_openssl.yml | 5 ++++- e2e/openssl/openssl_test.go | 33 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e_openssl.yml b/.github/workflows/e2e_openssl.yml index 1cd2bc1583..f382010147 100644 --- a/.github/workflows/e2e_openssl.yml +++ b/.github/workflows/e2e_openssl.yml @@ -54,7 +54,10 @@ jobs: just get-credentials - name: Build, deploy, contrast generate, contrast set, contrast verify run: | - just default openssl contrast.cli + for img in coordinator initializer openssl; do + just "$img" + done + just deploy openssl contrast.cli - name: Setup Summary run: | cat ./workspace/just.namespace | tee -a "${GITHUB_STEP_SUMMARY}" diff --git a/e2e/openssl/openssl_test.go b/e2e/openssl/openssl_test.go index e45ff65284..b6acdd2467 100644 --- a/e2e/openssl/openssl_test.go +++ b/e2e/openssl/openssl_test.go @@ -11,6 +11,7 @@ import ( "io" "os" "path" + "path/filepath" "testing" "time" @@ -30,6 +31,38 @@ func TestOpenSSL(t *testing.T) { namespace := os.Getenv(namespaceEnv) require.NotEmpty(t, namespace, "environment variable %q must be set", namespaceEnv) + require.True(t, t.Run("set", func(t *testing.T) { + require := require.New(t) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + require.NoError(c.WaitForDeployment(ctx, namespace, "coordinator")) + + coordinator, cancelPortForward, err := c.PortForwardPod(ctx, namespace, "port-forwarder-coordinator", "1313") + require.NoError(err) + defer cancelPortForward() + + resources, err := filepath.Glob("../../workspace/deployment/*.yml") + require.NoError(err) + + args := []string{ + "--coordinator-policy-hash=", // TODO(burgerdev): enable policy checking + "--coordinator", coordinator, + "--workspace-dir", "../../workspace", + } + args = append(args, resources...) + + set := cmd.NewSetCmd() + set.Flags().String("workspace-dir", "", "") // Make set aware of root flags + set.SetArgs(args) + set.SetOut(io.Discard) + errBuf := &bytes.Buffer{} + set.SetErr(errBuf) + + require.NoError(set.Execute(), "could not set manifest at coordinator: %s", errBuf) + }), "contrast set needs to succeed for subsequent tests") + certs := make(map[string][]byte) require.True(t, t.Run("contrast verify", func(t *testing.T) {