Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change from kubectl exec -> kubectl logs for data injection test #647

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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