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

e2e: fix policy test dependence on default policy test #1031

Merged
merged 1 commit into from
Nov 26, 2024
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
12 changes: 10 additions & 2 deletions e2e/policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,25 @@ func TestPolicy(t *testing.T) {

t.Log("Restarting container")

require.NoError(c.Restart(ctx, kubeclient.Deployment{}, ct.Namespace, coordinator))
require.NoError(c.Restart(ctx, kubeclient.StatefulSet{}, ct.Namespace, coordinator))
t.Log("Waiting to ensure container start up failed")

errRst := c.WaitForEvent(ctx, kubeclient.StartingBlocked, kubeclient.Pod{}, ct.Namespace, coordinatorPod)
require.NoError(errRst)
})

// initial deployment with pod allowed
require.True(t, t.Run("generate", ct.Generate), "contrast generate needs to succeed for subsequent tests")

ctx, cancel := context.WithTimeout(context.Background(), ct.FactorPlatformTimeout(1*time.Minute))
defer cancel()

require.True(t, t.Run("generate", ct.Generate), "contrast generate needs to succeed for subsequent tests")
require.True(t, t.Run("apply", ct.Apply), "Kubernetes resources need to be applied for subsequent tests")

require.NoError(t, ct.Kubeclient.Restart(ctx, kubeclient.StatefulSet{}, ct.Namespace, coordinator))
require.NoError(t, ct.Kubeclient.Restart(ctx, kubeclient.Deployment{}, ct.Namespace, opensslFrontend))
require.NoError(t, ct.Kubeclient.Restart(ctx, kubeclient.Deployment{}, ct.Namespace, opensslBackend))
// Set always waits for the coordinator to be ready, therefore we don not require an explicit waitFor() here
require.True(t, t.Run("set", ct.Set), "contrast set needs to succeed for subsequent tests")
require.True(t, t.Run("contrast verify", ct.Verify), "contrast verify needs to succeed for subsequent tests")

Expand Down