Skip to content

Commit

Permalink
Fix Wireguard e2e tests (#5467)
Browse files Browse the repository at this point in the history
Change the Wireguard e2e tests to make sure the TrafficEncryptionMode
will be reset to origin and namespaces created during setup will be
destroyed after tests finish.

Fixes #5488

Signed-off-by: ceclinux <src655@gmail.com>
  • Loading branch information
ceclinux authored Sep 15, 2023
1 parent a6ea1b6 commit 12ee556
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/e2e/wireguard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ func TestWireGuard(t *testing.T) {
skipIfAntreaIPAMTest(t)

data, err := setupTest(t)
skipIfEncapModeIsNot(t, data, config.TrafficEncapModeEncap)
for _, node := range clusterInfo.nodes {
skipIfMissingKernelModule(t, data, node.name, []string{"wireguard"})
}

if err != nil {
t.Fatalf("Error when setting up test: %v", err)
}
defer teardownTest(t, data)

skipIfEncapModeIsNot(t, data, config.TrafficEncapModeEncap)
for _, node := range clusterInfo.nodes {
skipIfMissingKernelModule(t, data, node.name, []string{"wireguard"})
}
var previousTrafficEncryptionMode string
ac := func(config *agentconfig.AgentConfig) {
previousTrafficEncryptionMode = config.TrafficEncryptionMode
config.TrafficEncryptionMode = "wireguard"
}
if err := data.mutateAntreaConfigMap(nil, ac, false, true); err != nil {
t.Fatalf("Failed to enable WireGuard tunnel: %v", err)
}
defer func() {
ac := func(config *agentconfig.AgentConfig) {
config.TrafficEncryptionMode = "none"
config.TrafficEncryptionMode = previousTrafficEncryptionMode
}
if err := data.mutateAntreaConfigMap(nil, ac, false, true); err != nil {
t.Errorf("Failed to disable WireGuard tunnel: %v", err)
Expand Down

0 comments on commit 12ee556

Please sign in to comment.