From 7be63878b8aa440838a97076903806a3d9955ff5 Mon Sep 17 00:00:00 2001 From: candita Date: Tue, 17 Jan 2023 19:56:19 -0500 Subject: [PATCH] Issue #1579 TLSRoute Passthrough - PR review update - latest --- conformance/utils/config/timeout.go | 6 ++++++ conformance/utils/http/http.go | 8 +------- conformance/utils/tls/tls.go | 8 +------- site-src/concepts/conformance.md | 11 +++++------ 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/conformance/utils/config/timeout.go b/conformance/utils/config/timeout.go index 91a1fd23fd..d1064e7066 100644 --- a/conformance/utils/config/timeout.go +++ b/conformance/utils/config/timeout.go @@ -70,6 +70,11 @@ type TimeoutConfig struct { // RequestTimeout represents the maximum time for making an HTTP Request with the roundtripper. // Max value for conformant implementation: None RequestTimeout time.Duration + + // RequiredConsecutiveSuccesses is the number of requests that must succeed in a row + // to consider a response "consistent" before making additional assertions on the response body. + // If this number is not reached within MaxTimeToConsistency, the test will fail. + RequiredConsecutiveSuccesses int } // DefaultTimeoutConfig populates a TimeoutConfig with the default values. @@ -88,6 +93,7 @@ func DefaultTimeoutConfig() TimeoutConfig { MaxTimeToConsistency: 30 * time.Second, NamespacesMustBeReady: 300 * time.Second, RequestTimeout: 10 * time.Second, + RequiredConsecutiveSuccesses: 3, } } diff --git a/conformance/utils/http/http.go b/conformance/utils/http/http.go index 76913eea8a..93f72dabbd 100644 --- a/conformance/utils/http/http.go +++ b/conformance/utils/http/http.go @@ -82,12 +82,6 @@ type Response struct { AbsentHeaders []string } -// requiredConsecutiveSuccesses is the number of requests that must succeed in a row -// for MakeRequestAndExpectEventuallyConsistentResponse to consider the response "consistent" -// before making additional assertions on the response body. If this number is not reached within -// maxTimeToConsistency, the test will fail. -const requiredConsecutiveSuccesses = 3 - // MakeRequestAndExpectEventuallyConsistentResponse makes a request with the given parameters, // understanding that the request may fail for some amount of time. // @@ -98,7 +92,7 @@ func MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, r roundtripp req := MakeRequest(t, &expected, gwAddr, "HTTP", "http") - WaitForConsistentResponse(t, r, req, expected, requiredConsecutiveSuccesses, timeoutConfig.MaxTimeToConsistency) + WaitForConsistentResponse(t, r, req, expected, timeoutConfig.RequiredConsecutiveSuccesses, timeoutConfig.MaxTimeToConsistency) } func MakeRequest(t *testing.T, expected *ExpectedResponse, gwAddr, protocol, scheme string) roundtripper.Request { diff --git a/conformance/utils/tls/tls.go b/conformance/utils/tls/tls.go index 10eb9b9b44..16e2326726 100644 --- a/conformance/utils/tls/tls.go +++ b/conformance/utils/tls/tls.go @@ -25,12 +25,6 @@ import ( "sigs.k8s.io/gateway-api/conformance/utils/roundtripper" ) -// requiredConsecutiveSuccesses is the number of requests that must succeed in a row -// for MakeRequestAndExpectEventuallyConsistentResponse to consider the response "consistent" -// before making additional assertions on the response body. If this number is not reached within -// maxTimeToConsistency, the test will fail. -const requiredConsecutiveSuccesses = 3 - // MakeTLSRequestAndExpectEventuallyConsistentResponse makes a request with the given parameters, // understanding that the request may fail for some amount of time. // @@ -41,7 +35,7 @@ func MakeTLSRequestAndExpectEventuallyConsistentResponse(t *testing.T, r roundtr req := http.MakeRequest(t, &expected, gwAddr, "HTTPS", "https") - WaitForConsistentTLSResponse(t, r, req, expected, requiredConsecutiveSuccesses, timeoutConfig.MaxTimeToConsistency, cPem, keyPem, server) + WaitForConsistentTLSResponse(t, r, req, expected, timeoutConfig.RequiredConsecutiveSuccesses, timeoutConfig.MaxTimeToConsistency, cPem, keyPem, server) } // WaitForConsistentTLSResponse - repeats the provided request until it completes with a response having diff --git a/site-src/concepts/conformance.md b/site-src/concepts/conformance.md index cfecc0240f..8f43f433ab 100644 --- a/site-src/concepts/conformance.md +++ b/site-src/concepts/conformance.md @@ -74,14 +74,13 @@ capabilities. ### Running Tests -By default, conformance tests will expect a `gateway-conformance` GatewayClass -to be installed in the cluster and tests will be run against that. A different -class can be specified with the `-gateway-class` flag along with the -corresponding test command. For example, to run a conformance test against Istio, -run: +By default, conformance tests will expect a GatewayClass named `gateway-conformance` +to be installed in the cluster, and tests will be run against that. Most often, +you'll use a different class, which can be specified with the `-gateway-class` flag along with the +corresponding test command. Check your instance for the `gateway-class` name to use. ```shell -go test ./conformance/... -args -gateway-class=istio +go test ./conformance/... -args -gateway-class=my-gateway-class ``` Other useful flags may be found in