Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ mode, use
test/local-e2e-tests.sh -short
```

### Running tests with HTTPS

When running tests against a cluster configured to use HTTPS, use the `--https` flag to make tests expect HTTPS URLs:

```bash
test/local-e2e-tests.sh --https
```

### Running E2E tests as a project admin

It is possible to run the E2E tests by a user with reduced privileges, e.g. project admin.
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/domain_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ func domainDescribe(r *test.KnRunResultCollector, domainName string, tls bool) {
out := r.KnTest().Kn().Run("domain", "describe", domainName)
r.AssertNoError(out)
var url string
if tls {
// Use HTTPS if either TLS is explicitly configured or the --https flag is set
if tls || ClientFlags.HTTPS {
url = "https://" + domainName
} else {
url = "http://" + domainName
Expand Down
41 changes: 41 additions & 0 deletions test/e2e/e2e_flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2025 The Knative Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// This file contains logic to encapsulate flags which are needed to specify
// what cluster, etc. to use for e2e tests.

package e2e

import (
"flag"

_ "knative.dev/pkg/test"
)

var ClientFlags = initializeClientFlags()

type ClientEnvironmentFlags struct {
HTTPS bool
}

func initializeClientFlags() *ClientEnvironmentFlags {
var f ClientEnvironmentFlags

flag.BoolVar(&f.HTTPS, "https", false,
"Set this flag to true to run all tests with https.")

return &f
}