Skip to content

Commit

Permalink
Add request delay to timeout check
Browse files Browse the repository at this point in the history
  • Loading branch information
nader-ziada committed Apr 9, 2024
1 parent fff22b1 commit 642a0f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 5 additions & 0 deletions test/conformance/ingress/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func TestTimeout(t *testing.T) {

func checkTimeout(ctx context.Context, t *testing.T, client *http.Client, name string, code int, initial time.Duration, timeout time.Duration) {
t.Helper()
t.Logf("delay of %d before doing the request \n", test.NetworkingFlags.RequestDelay)
if test.NetworkingFlags.RequestDelay < 0 {
t.Error("Error creating Request:", fmt.Errorf("request delay value must be greater than or equal to 0, receieved %d", test.NetworkingFlags.RequestDelay))
}
time.Sleep(time.Duration(test.NetworkingFlags.RequestDelay) * time.Second)

resp, err := client.Get(fmt.Sprintf("http://%s.%s?initialTimeout=%d&timeout=%d",
name, test.NetworkingFlags.ServiceDomain, initial.Milliseconds(), timeout.Milliseconds()))
Expand Down
12 changes: 1 addition & 11 deletions test/conformance/ingress/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,16 +1046,6 @@ func CreateDialContext(ctx context.Context, t *testing.T, ing *v1alpha1.Ingress,
// TODO(mattmoor): I'm open to tricks that would let us cleanly test multiple
// public load balancers or LBs with multiple ingresses (below), but want to
// keep our simple tests simple, thus the [0]s...
dial := network.NewBackoffDialer(dialBackoff)
ingressIP := ing.Status.PublicLoadBalancer.Ingress[0].IP
if ingressIP != "" {
return func(ctx context.Context, _ string, address string) (net.Conn, error) {
if ingressIP != "" {
return dial(ctx, "tcp", ingressIP+":80")
}
return nil, errors.New("service ingress does not contain dialing information")
}
}
// We expect an ingress LB with the form foo.bar.svc.cluster.local (though
// we aren't strictly sensitive to the suffix, this is just illustrative.
internalDomain := ing.Status.PublicLoadBalancer.Ingress[0].DomainInternal
Expand All @@ -1074,7 +1064,7 @@ func CreateDialContext(ctx context.Context, t *testing.T, ing *v1alpha1.Ingress,
t.Fatalf("Unable to retrieve Kubernetes service %s/%s: %v", namespace, name, err)
}

//dial := network.NewBackoffDialer(dialBackoff)
dial := network.NewBackoffDialer(dialBackoff)
if pkgTest.Flags.IngressEndpoint != "" {
t.Logf("ingressendpoint: %q", pkgTest.Flags.IngressEndpoint)

Expand Down

0 comments on commit 642a0f2

Please sign in to comment.