Skip to content

Commit

Permalink
identify each request in update test using a query timestamp (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso authored Apr 16, 2024
1 parent 1d9a7cf commit 594a2f8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/conformance/ingress/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package ingress
import (
"context"
"net/http"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -108,7 +109,7 @@ func TestUpdate(t *testing.T) {

// Check that it serves the right message as soon as we get "Ready",
// but before we stop probing.
ri := RuntimeRequest(ctx, t, client, "http://"+hostname+"."+test.NetworkingFlags.ServiceDomain)
ri := RuntimeRequest(ctx, t, client, "http://"+hostname+"."+test.NetworkingFlags.ServiceDomain+timeQuery())
if ri != nil {
if got := ri.Request.Headers.Get(updateHeaderName); got != sentinel {
t.Errorf("Header[%q] = %q, wanted %q", updateHeaderName, got, sentinel)
Expand Down Expand Up @@ -151,7 +152,7 @@ func TestUpdate(t *testing.T) {

// Check that it serves the right message as soon as we get "Ready",
// but before we stop probing.
ri := RuntimeRequest(ctx, t, client, "http://"+hostname+"."+test.NetworkingFlags.ServiceDomain)
ri := RuntimeRequest(ctx, t, client, "http://"+hostname+"."+test.NetworkingFlags.ServiceDomain+timeQuery())
if ri != nil {
if got := ri.Request.Headers.Get(updateHeaderName); got != sentinel {
t.Errorf("Header[%q] = %q, wanted %q", updateHeaderName, got, sentinel)
Expand Down Expand Up @@ -184,7 +185,7 @@ func checkOK(ctx context.Context, t *testing.T, url string, client *http.Client)
}
// Scope the defer below to avoid leaking until the test completes.
func() {
ri := RuntimeRequest(ctx, t, client, url)
ri := RuntimeRequest(ctx, t, client, url+timeQuery())
if ri != nil {
// Use the updateHeaderName as a debug marker to identify which version
// (of programming) is responding.
Expand All @@ -200,3 +201,7 @@ func checkOK(ctx context.Context, t *testing.T, url string, client *http.Client)
<-doneCh
}
}

func timeQuery() string {
return "?time=" + strconv.FormatInt(time.Now().UnixNano(), 10)
}

0 comments on commit 594a2f8

Please sign in to comment.