Merge pull request #95132 from jluhrsen/nw-policy-debug

Network policy test debug and cleanup
This commit is contained in:
Kubernetes Prow Robot 2020-09-30 11:24:54 -07:00 committed by GitHub
commit 4373d9aadd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}