Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identify each request in update test using a query timestamp #967

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading