Skip to content

Commit

Permalink
change from kubectl exec -> kubectl logs for data injection test (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-mccoy authored Jul 28, 2022
1 parent a81714b commit f5b4129
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/test/e2e/23_data_injection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"

"github.com/defenseunicorns/zarf/src/internal/k8s"
"github.com/defenseunicorns/zarf/src/internal/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -27,15 +26,11 @@ func TestDataInjection(t *testing.T) {
stdOut, stdErr, err := utils.ExecCommandWithContext(ctx, true, e2e.zarfBinPath, "package", "deploy", path, "--confirm")
require.NoError(t, err, stdOut, stdErr)

// Get the data injection pod
pods, err := k8s.GetPods("demo")
require.NoError(t, err)
require.Equal(t, len(pods.Items), 1)
pod := pods.Items[0]

stdOut, stdErr, err = utils.ExecCommandWithContext(context.TODO(), true, "kubectl", "-n", pod.Namespace, "exec", pod.Name, "--", "ls", "/test")
// verify the file and injection marker were created
stdOut, stdErr, err = utils.ExecCommandWithContext(context.TODO(), true, "kubectl", "--namespace=demo", "logs", "--tail=5", "--selector=app=data-injection")
require.NoError(t, err, stdOut, stdErr)
assert.Contains(t, stdOut, "this-is-an-example-file.txt")
assert.Contains(t, stdOut, ".zarf-injection-")

e2e.chartsToRemove = append(e2e.chartsToRemove, ChartTarget{
namespace: "demo",
Expand Down

0 comments on commit f5b4129

Please sign in to comment.