Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping knative.dev/networking ca2ffb8...a3d8b0f:
  > a3d8b0f Replace all usages of deprecated wait.PollImmediate with wait.PollUntilContextTimeout (# 957)
  > 1a6e0da some conformance tests assume we're getting back a runtime request (# 964)
  > 2a4859c this fixes the probe handler to reflect that it doesn't care about the path (# 963)
  > b321831 upgrade to latest dependencies (# 962)
  > 2002961 🎁  Add test flags for the conformance suite (# 960)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Apr 11, 2024
1 parent 6c0d430 commit cae443b
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 71 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7
knative.dev/networking v0.0.0-20240409134343-ca2ffb806de2
knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2
knative.dev/pkg v0.0.0-20240409141558-1ff9a77566f6
sigs.k8s.io/yaml v1.4.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7 h1:fkWYWvdHm1mVHevKW2vVJnZtxH0NzOlux8imesweKwE=
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20240409134343-ca2ffb806de2 h1:Sjr1rJ97ow6ipuLSGnR2EZFcVnwMRdVpjgMzVdGvv/U=
knative.dev/networking v0.0.0-20240409134343-ca2ffb806de2/go.mod h1:m9aH65g5JGuwhH6moqAmF0+X6PvIQwElVx5dw2+jDno=
knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2 h1:W8M/cxPYUOIjNcwQ3w2Il/qlYKpZBPJ89ysTr5MTI/A=
knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2/go.mod h1:yXbBRuzGKDkHSdvqUT7/1j9br5gkJL9LAyxpHfcF3h8=
knative.dev/pkg v0.0.0-20240409141558-1ff9a77566f6 h1:jJVStFc+y8c7veKYDyQFwQTod+w5pzZqopz/nLH2dJo=
knative.dev/pkg v0.0.0-20240409141558-1ff9a77566f6/go.mod h1:ZWUA+Z6zFI93VyExtnH0P5JtVQ0TvWpKvbxtFvmRJ9I=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/networking/pkg/prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (m *Manager) doAsync(ctx context.Context, target string, arg interface{}, p
result bool
inErr error
)
err := wait.PollImmediate(period, timeout, func() (bool, error) {
err := wait.PollUntilContextTimeout(ctx, period, timeout, true, func(ctx context.Context) (bool, error) {
result, inErr = Do(ctx, m.transport, target, ops...)
// Do not return error, which is from verifierError, as retry is expected until timeout.
return result, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestBasics(t *testing.T) {
// Create a simple Ingress over the Service.
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand All @@ -52,7 +52,7 @@ func TestBasics(t *testing.T) {
}},
})

RuntimeRequest(ctx, t, client, "http://"+name+".example.com")
RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain)
}

// TestBasicsHTTP2 verifies that the same no-frills Ingress over a Service with http/2 configured
Expand All @@ -69,7 +69,7 @@ func TestBasicsHTTP2(t *testing.T) {
// Create a simple Ingress over the Service.
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand All @@ -85,7 +85,7 @@ func TestBasicsHTTP2(t *testing.T) {
}},
})

ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com")
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain)
if ri == nil {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func verifyIngressWithAnnotations(ctx context.Context, t *testing.T, clients *te
original, _ := CreateIngress(ctx, t, clients,
v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{backend.ServiceName + ".example.com"},
Hosts: []string{backend.ServiceName + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestGRPC(t *testing.T) {
const suffix = "- pong"
name, port, _ := CreateGRPCService(ctx, t, clients, suffix)

domain := name + ".example.com"
domain := name + "." + test.NetworkingFlags.ServiceDomain

// Create a simple Ingress over the Service.
_, dialCtx, _ := createIngressReadyDialContext(ctx, t, clients, v1alpha1.IngressSpec{
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestGRPCSplit(t *testing.T) {

// Create a simple Ingress over the Service.
name := test.ObjectNameForTest(t)
domain := name + ".example.com"
domain := name + "." + test.NetworkingFlags.ServiceDomain
_, dialCtx, _ := createIngressReadyDialContext(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{domain},
Expand Down
44 changes: 24 additions & 20 deletions vendor/knative.dev/networking/test/conformance/ingress/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestProbeHeaders(t *testing.T) {
// Create a simple Ingress over the Service.
ing, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down Expand Up @@ -83,21 +83,25 @@ func TestProbeHeaders(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

ros := []RequestOption{}
req, err := http.NewRequest("GET", fmt.Sprintf("http://%s.%s", name, test.NetworkingFlags.ServiceDomain), nil)
if err != nil {
t.Fatal("Error creating request:", err)
}
req.Header.Set(header.ProbeKey, header.ProbeValue)
req.Header.Set(header.HashKey, tt.req)

ros = append(ros, func(r *http.Request) {
// Add the header to indicate this is a probe request.
r.Header.Set(header.ProbeKey, header.ProbeValue)
r.Header.Set(header.HashKey, tt.req)
})
resp, err := client.Do(req)
if err != nil {
t.Fatal("Error making GET request:", err)
}
defer resp.Body.Close()

ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com", ros...)
if ri == nil {
t.Error("Couldn't make request")
return
if resp.StatusCode != http.StatusOK {
t.Errorf("Unexpected status code: %d, wanted %d", resp.StatusCode, http.StatusOK)
DumpResponse(ctx, t, resp)
}

if got, want := ri.Request.Headers.Get(header.HashKey), tt.want; got != want {
if got, want := resp.Header.Get(header.HashKey), tt.want; got != want {
t.Errorf("Header[%q] = %q, wanted %q", header.HashKey, got, want)
}
})
Expand All @@ -124,7 +128,7 @@ func TestTagHeaders(t *testing.T) {

_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down Expand Up @@ -195,7 +199,7 @@ func TestTagHeaders(t *testing.T) {
})
}

ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com", ros...)
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain, ros...)
if ri == nil {
t.Error("Couldn't make request")
return
Expand All @@ -221,7 +225,7 @@ func TestPreSplitSetHeaders(t *testing.T) {
// Create a simple Ingress over the 10 Services.
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand All @@ -243,7 +247,7 @@ func TestPreSplitSetHeaders(t *testing.T) {
t.Run("Check without passing header", func(t *testing.T) {
t.Parallel()

ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com")
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain)
if ri == nil {
return
}
Expand All @@ -256,7 +260,7 @@ func TestPreSplitSetHeaders(t *testing.T) {
t.Run("Check with passing header", func(t *testing.T) {
t.Parallel()

ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com", func(req *http.Request) {
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain, func(req *http.Request) {
// Specify a value for the header to verify that implementations
// use set vs. append semantics.
req.Header.Set(headerName, "bogus")
Expand Down Expand Up @@ -306,7 +310,7 @@ func TestPostSplitSetHeaders(t *testing.T) {
name := test.ObjectNameForTest(t)
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand All @@ -324,7 +328,7 @@ func TestPostSplitSetHeaders(t *testing.T) {
// particular test.
seen := make(sets.Set[string], len(names))
for i := 0; i < maxRequests; i++ {
ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com")
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain)
if ri == nil {
return
}
Expand All @@ -347,7 +351,7 @@ func TestPostSplitSetHeaders(t *testing.T) {
// particular test.
seen := make(sets.Set[string], len(names))
for i := 0; i < maxRequests; i++ {
ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com", func(req *http.Request) {
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain, func(req *http.Request) {
// Specify a value for the header to verify that implementations
// use set vs. append semantics.
req.Header.Set(headerName, "bogus")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestHTTPOption(t *testing.T) {
func create(ctx context.Context, t *testing.T, clients *test.Clients, httpOption v1alpha1.HTTPOption) (string, *http.Client) {
name, port, _ := CreateRuntimeService(ctx, t, clients, networking.ServicePortNameHTTP1)

hosts := []string{name + ".example.com"}
hosts := []string{name + "." + test.NetworkingFlags.ServiceDomain}

secretName, tlsConfig, _ := CreateTLSSecret(ctx, t, clients, hosts)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestPath(t *testing.T) {

_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down Expand Up @@ -131,7 +131,7 @@ func TestPath(t *testing.T) {
t.Run(path, func(t *testing.T) {
t.Parallel()

ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com"+path)
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain+path)
if ri == nil {
return
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func TestPathAndPercentageSplit(t *testing.T) {

_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestPathAndPercentageSplit(t *testing.T) {

for i := 0; i < total; i++ {
g.Go(func() error {
ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com/foo")
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain+"/foo")
if ri == nil {
return errors.New("failed to request")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestPercentage(t *testing.T) {
name := test.ObjectNameForTest(t)
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestPercentage(t *testing.T) {

for i := 0.0; i < totalRequests; i++ {
g.Go(func() error {
ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com")
ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain)
if ri == nil {
return errors.New("failed to request")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestRetry(t *testing.T) {
t.Parallel()
ctx, clients := context.Background(), test.Setup(t)
name, port, _ := CreateRetryService(ctx, t, clients)
domain := name + ".example.com"
domain := name + "." + test.NetworkingFlags.ServiceDomain

// Create a simple Ingress over the Service.
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestRule(t *testing.T) {

_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{fooName + ".example.com"},
Hosts: []string{fooName + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand All @@ -58,7 +58,7 @@ func TestRule(t *testing.T) {
}},
},
}, {
Hosts: []string{barName + ".example.com"},
Hosts: []string{barName + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand All @@ -77,12 +77,12 @@ func TestRule(t *testing.T) {
}},
})

ri := RuntimeRequest(ctx, t, client, "http://"+fooName+".example.com")
ri := RuntimeRequest(ctx, t, client, "http://"+fooName+"."+test.NetworkingFlags.ServiceDomain)
if got := ri.Request.Headers.Get(headerName); got != fooName {
t.Errorf("Header[Host] = %q, wanted %q", got, fooName)
}

ri = RuntimeRequest(ctx, t, client, "http://"+barName+".example.com")
ri = RuntimeRequest(ctx, t, client, "http://"+barName+"."+test.NetworkingFlags.ServiceDomain)
if got := ri.Request.Headers.Get(headerName); got != barName {
t.Errorf("Header[Host] = %q, wanted %q", got, barName)
}
Expand Down
13 changes: 10 additions & 3 deletions vendor/knative.dev/networking/test/conformance/ingress/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestTimeout(t *testing.T) {
// Create a simple Ingress over the Service.
_, client, _ := CreateIngressReady(ctx, t, clients, v1alpha1.IngressSpec{
Rules: []v1alpha1.IngressRule{{
Hosts: []string{name + ".example.com"},
Hosts: []string{name + "." + test.NetworkingFlags.ServiceDomain},
Visibility: v1alpha1.IngressVisibilityExternalIP,
HTTP: &v1alpha1.HTTPIngressRuleValue{
Paths: []v1alpha1.HTTPIngressPath{{
Expand Down Expand Up @@ -86,9 +86,16 @@ 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()
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))
}
if test.NetworkingFlags.RequestDelay > 0 {
t.Logf("delay of %d before doing the request", test.NetworkingFlags.RequestDelay)
time.Sleep(time.Duration(test.NetworkingFlags.RequestDelay) * time.Second)
}

resp, err := client.Get(fmt.Sprintf("http://%s.example.com?initialTimeout=%d&timeout=%d",
name, initial.Milliseconds(), timeout.Milliseconds()))
resp, err := client.Get(fmt.Sprintf("http://%s.%s?initialTimeout=%d&timeout=%d",
name, test.NetworkingFlags.ServiceDomain, initial.Milliseconds(), timeout.Milliseconds()))
if err != nil {
t.Fatal("Error making GET request:", err)
}
Expand Down
6 changes: 3 additions & 3 deletions vendor/knative.dev/networking/test/conformance/ingress/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestIngressTLS(t *testing.T) {

name, port, _ := CreateRuntimeService(ctx, t, clients, networking.ServicePortNameHTTP1)

hosts := []string{name + ".example.com"}
hosts := []string{name + "." + test.NetworkingFlags.ServiceDomain}

secretName, tlsConfig, _ := CreateTLSSecret(ctx, t, clients, hosts)

Expand Down Expand Up @@ -61,10 +61,10 @@ func TestIngressTLS(t *testing.T) {
}, tlsConfig)

// Check without TLS.
RuntimeRequest(ctx, t, client, "http://"+name+".example.com")
RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain)

// Check with TLS.
RuntimeRequest(ctx, t, client, "https://"+name+".example.com")
RuntimeRequest(ctx, t, client, "https://"+name+"."+test.NetworkingFlags.ServiceDomain)
}

// TODO(mattmoor): Consider adding variants where we have multiple hosts with distinct certificates.
Loading

0 comments on commit cae443b

Please sign in to comment.