mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Use native Ginkgo test runner instead of cmd/e2e.
This commit deletes cmd/e2e and updates hack/ginkgo-e2e.sh to use the 'ginkgo' command instead. All logic from cmd/e2e/e2e.go and test/e2e/driver.go have been combined into the new file test/e2e/e2e_test.go. Additionally, several tests which made poor assumptions about cwd or used testContext before it was set have been fixed. This change is generally intended to have no externally visible changes, aside from the following caveats: - The -t/--tests flag has been removed - Calling cmd/e2e/e2e directly obviously won't work, but that was never supported anyway - If the GINKGO_PARALLEL environment variable is set to y, then ginkgo will run test specs in parallel. (Currently defaults to n, since some tests are broken in this mode.)
This commit is contained in:
@@ -22,20 +22,19 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var (
|
||||
root = absOrDie(filepath.Clean(filepath.Join(path.Base(os.Args[0]), "..")))
|
||||
root = kubeRootOrDie()
|
||||
)
|
||||
|
||||
var _ = Describe("Shell", func() {
|
||||
|
||||
defer GinkgoRecover()
|
||||
// Slurp up all the tests in hack/e2e-suite
|
||||
// This should be using testContext.RepoRoot, but this is evaluated before flags are evaluated, so we are stuck.
|
||||
bashE2ERoot := filepath.Join(root, "hack/e2e-suite")
|
||||
files, err := ioutil.ReadDir(bashE2ERoot)
|
||||
if err != nil {
|
||||
@@ -56,8 +55,13 @@ var _ = Describe("Shell", func() {
|
||||
}
|
||||
})
|
||||
|
||||
func absOrDie(path string) string {
|
||||
out, err := filepath.Abs(path)
|
||||
// Returns the root directory of the Kubernetes source tree, assuming the test lives inside test/e2e.
|
||||
func kubeRootOrDie() string {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
out, err := filepath.Abs(filepath.Join(cwd, "..", ".."))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user