mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 05:30:26 +00:00
Once again, 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. The test tarball now includes a built version of the test/e2e test binary, which includes all tests under test/e2e. This was accomplished by updating the build scripts to use 'go test -c' when a target name ended with '.test', and adding a dependency on test/e2e/e2e.test. This prebuilt test binary is passed to the Ginkgo runner in hack/ginkgo-e2e.sh. In a future change, we can add support to run Ginkgo against the source tree if it is available. 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 intended to be 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.) Additionally, several tests which made poor assumptions about cwd or used testContext before it had been set have been fixed.
This commit is contained in:
@@ -19,7 +19,6 @@ package e2e
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
@@ -27,36 +26,19 @@ import (
|
||||
)
|
||||
|
||||
var _ = Describe("Shell", func() {
|
||||
bashE2ERoot := filepath.Join(testContext.RepoRoot, "hack/e2e-suite")
|
||||
defer GinkgoRecover()
|
||||
|
||||
// Slurp up all the tests in hack/e2e-suite
|
||||
files, err := ioutil.ReadDir(bashE2ERoot)
|
||||
if err != nil {
|
||||
Fail(fmt.Sprintf("Error reading test suites from %v %v", bashE2ERoot, err.Error()))
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
fileName := file.Name() // Make a copy
|
||||
It(fmt.Sprintf("tests that %v passes", fileName), func() {
|
||||
// A number of scripts only work on gce
|
||||
if !providerIs("gce", "gke") {
|
||||
By(fmt.Sprintf("Skipping Shell test %s, which is only supported for provider gce and gke (not %s)",
|
||||
fileName, testContext.Provider))
|
||||
return
|
||||
}
|
||||
runCmdTest(filepath.Join(bashE2ERoot, fileName))
|
||||
})
|
||||
}
|
||||
It(fmt.Sprintf("tests that services.sh passes"), func() {
|
||||
// The services script only works on gce/gke
|
||||
if !providerIs("gce", "gke") {
|
||||
By(fmt.Sprintf("Skipping Shell test services.sh, which is only supported for provider gce and gke (not %s)",
|
||||
testContext.Provider))
|
||||
return
|
||||
}
|
||||
runCmdTest(filepath.Join(testContext.RepoRoot, "hack/e2e-suite/services.sh"))
|
||||
})
|
||||
})
|
||||
|
||||
func absOrDie(path string) string {
|
||||
out, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Runs the given cmd test.
|
||||
func runCmdTest(path string) {
|
||||
By(fmt.Sprintf("Running %v", path))
|
||||
|
Reference in New Issue
Block a user