Skip to content

Commit

Permalink
Issue kubernetes-sigs#1579 TLSRoute Passthrough - PR review update - …
Browse files Browse the repository at this point in the history
…latest
  • Loading branch information
candita committed Jan 18, 2023
1 parent d8b5ff6 commit 7be6387
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
6 changes: 6 additions & 0 deletions conformance/utils/config/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -88,6 +93,7 @@ func DefaultTimeoutConfig() TimeoutConfig {
MaxTimeToConsistency: 30 * time.Second,
NamespacesMustBeReady: 300 * time.Second,
RequestTimeout: 10 * time.Second,
RequiredConsecutiveSuccesses: 3,
}
}

Expand Down
8 changes: 1 addition & 7 deletions conformance/utils/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -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 {
Expand Down
8 changes: 1 addition & 7 deletions conformance/utils/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions site-src/concepts/conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7be6387

Please sign in to comment.