Skip to content

Commit 4373d9a

Browse files
authored
Merge pull request kubernetes#95132 from jluhrsen/nw-policy-debug
Network policy test debug and cleanup
2 parents aa1f912 + ae63d64 commit 4373d9a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/e2e/network/network_policy.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,11 +2017,12 @@ func checkConnectivity(f *framework.Framework, ns *v1.Namespace, podClient *v1.P
20172017
framework.Logf("Waiting for %s to complete.", podClient.Name)
20182018
err = e2epod.WaitForPodSuccessInNamespace(f.ClientSet, podClient.Name, ns.Name)
20192019
if err != nil {
2020+
// Dump debug information for the test namespace.
2021+
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
2022+
20202023
pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient)
20212024
framework.Failf("Pod %s should be able to connect to service %s, but was not able to connect.\nPod logs:\n%s\n\n Current NetworkPolicies:\n\t%v\n\n Pods:\n\t%v\n\n", podClient.Name, service.Name, logs, policies.Items, pods)
20222025

2023-
// Dump debug information for the test namespace.
2024-
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
20252026
}
20262027
}
20272028

@@ -2032,11 +2033,12 @@ func checkNoConnectivity(f *framework.Framework, ns *v1.Namespace, podClient *v1
20322033
// We expect an error here since it's a cannot connect test.
20332034
// Dump debug information if the error was nil.
20342035
if err == nil {
2036+
// Dump debug information for the test namespace.
2037+
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
2038+
20352039
pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient)
20362040
framework.Failf("Pod %s should not be able to connect to service %s, but was able to connect.\nPod logs:\n%s\n\n Current NetworkPolicies:\n\t%v\n\n Pods:\n\t %v\n\n", podClient.Name, service.Name, logs, policies.Items, pods)
20372041

2038-
// Dump debug information for the test namespace.
2039-
framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name)
20402042
}
20412043
}
20422044

0 commit comments

Comments
 (0)