diff --git a/test/e2e/network/network_policy.go b/test/e2e/network/network_policy.go index c32fadf82fb..7320cc0b47f 100644 --- a/test/e2e/network/network_policy.go +++ b/test/e2e/network/network_policy.go @@ -2017,11 +2017,12 @@ func checkConnectivity(f *framework.Framework, ns *v1.Namespace, podClient *v1.P framework.Logf("Waiting for %s to complete.", podClient.Name) err = e2epod.WaitForPodSuccessInNamespace(f.ClientSet, podClient.Name, ns.Name) if err != nil { + // Dump debug information for the test namespace. + framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name) + pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient) 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) - // Dump debug information for the test namespace. - framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name) } } @@ -2032,11 +2033,12 @@ func checkNoConnectivity(f *framework.Framework, ns *v1.Namespace, podClient *v1 // We expect an error here since it's a cannot connect test. // Dump debug information if the error was nil. if err == nil { + // Dump debug information for the test namespace. + framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name) + pods, policies, logs := collectPodsAndNetworkPolicies(f, podClient) 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) - // Dump debug information for the test namespace. - framework.DumpDebugInfo(f.ClientSet, f.Namespace.Name) } }