@@ -729,9 +729,17 @@ func testWebhook(f *framework.Framework) {
729
729
pod = hangingPod (f )
730
730
_ , err = client .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
731
731
framework .ExpectError (err , "create pod %s in namespace %s should have caused webhook to hang" , pod .Name , f .Namespace .Name )
732
- expectedTimeoutErr := "request did not complete within"
733
- if ! strings .Contains (err .Error (), expectedTimeoutErr ) {
734
- e2elog .Failf ("expect timeout error %q, got %q" , expectedTimeoutErr , err .Error ())
732
+ // ensure the error is webhook-related, not client-side
733
+ if ! strings .Contains (err .Error (), "webhook" ) {
734
+ e2elog .Failf ("expect error %q, got %q" , "webhook" , err .Error ())
735
+ }
736
+ // ensure the error is a timeout
737
+ if ! strings .Contains (err .Error (), "deadline" ) {
738
+ e2elog .Failf ("expect error %q, got %q" , "deadline" , err .Error ())
739
+ }
740
+ // ensure the pod was not actually created
741
+ if _ , err := client .CoreV1 ().Pods (f .Namespace .Name ).Get (pod .Name , metav1.GetOptions {}); ! errors .IsNotFound (err ) {
742
+ e2elog .Failf ("expect notfound error looking for rejected pod, got %v" , err )
735
743
}
736
744
737
745
ginkgo .By ("create a configmap that should be denied by the webhook" )
0 commit comments