Open
Description
Rewrite the e2e-tests.sh
script (https://github.com/knative/hack/blob/main/README.md#using-the-e2e-testssh-helper-script) into a Golang tool knative.dev/toolbox/presubmit
.
Invent new Go-native extension interface, for example:
# will look for Go files with `e2e` build constraints, that register configuration
go run knative.dev/toolbox/e2e@latest --run-tests
An example configuration might look like:
//go:build e2e
package test
import (
"fmt"
"os"
"github.com/bitfield/script"
"knative.dev/toolbox/e2e/pkg/config"
"knative.dev/toolbox/e2e/pkg/commands/knative"
"knative.dev/toolbox/e2e/pkg/commands/wait"
)
var waitForKnative = true
init {
config.Configure(config.Hooks{
KnativeSetup: function(ctx config.Context) error {
if err := knative.StartServingLatest(); err != nil {
return err
}
if waitForKnative {
return wait.UntilPodsRunning("knative-serving")
}
return nil
},
DefineFlags: function(fs *flag.FlagSet) {
fs.BoolVar(&waitForKnative, "wait-for-knative", true, "wait for Knative install?")
},
Tests: []config.E2eSuite{{
Name: "Istio",
Dir: "./...",
Flags: ["--istio"],
}},
})
}