@@ -1703,7 +1703,7 @@ var _ = common.SIGDescribe("Services", func() {
1703
1703
}
1704
1704
break
1705
1705
}
1706
- if apierrors .IsConflict (err ) {
1706
+ if apierrors .IsInvalid (err ) {
1707
1707
framework .Logf ("node port %d is already allocated to other service, retrying ... : %v" , port , err )
1708
1708
continue
1709
1709
}
@@ -3979,15 +3979,20 @@ var _ = common.SIGDescribe("Services", func() {
3979
3979
}
3980
3980
break
3981
3981
}
3982
- if apierrors .IsConflict (err ) {
3982
+ if apierrors .IsInvalid (err ) {
3983
3983
framework .Logf ("node port %d is already allocated to other service, retrying ... : %v" , port , err )
3984
3984
continue
3985
3985
}
3986
3986
framework .ExpectNoError (err , "failed to create service: %s in namespace: %s" , serviceName , namespace )
3987
3987
3988
3988
}
3989
3989
3990
- defer e2eservice .ReleaseStaticNodePort (svc .Spec .HealthCheckNodePort )
3990
+ ginkgo .DeferCleanup (func (ctx context.Context ) {
3991
+ err := cs .CoreV1 ().Services (namespace ).Delete (ctx , serviceName , metav1.DeleteOptions {})
3992
+ framework .ExpectNoError (err , "failed to delete service: %s in namespace: %s" , serviceName , namespace )
3993
+ e2eservice .ReleaseStaticNodePort (svc .Spec .HealthCheckNodePort )
3994
+ })
3995
+
3991
3996
nodePortStr := fmt .Sprintf ("%d" , svc .Spec .Ports [0 ].NodePort )
3992
3997
hcNodePortStr := fmt .Sprintf ("%d" , svc .Spec .HealthCheckNodePort )
3993
3998
framework .Logf ("NodePort is %s, HealthCheckNodePort is %s" , nodePortStr , hcNodePortStr )
0 commit comments