
The new test/e2e/framework/testfiles package makes it possible to write tests that do not depend on a specific way of providing additional test files at runtime. Such tests and the framework are then more easily reused in other test suites. In the test/e2e suite file access is enabled based on the existing "repo-root" command line parameter and the built-in bindata. Tests using the new API will first check for files under "repo-root" and then fall back to the builtin data. This way, users of a test binary can modify those files without having to rebuild the binary. "repo-root" is still needed because at least some tests check for additional files (secret.yaml, via ingress_utils.go) that are not part of the upstream source code and thus may or may not be built into a test binary. Tests using bindata or repo-root directly get modified to use the new API, or removed when they are obsolete: test/e2e/examples.go depended on files that were removed in https://github.com/kubernetes/kubernetes/pull/61246 and thus can no longer be run in Kubernetes. Moving the tests to kubernetes/examples is tracked in https://github.com/kubernetes/examples/issues/214. The file removal did not break the automated E2E testing probably because the tests are under the Feature:Example tag and thus not enabled during normal CI runs. Removing also the obsolete tests makes it simpler to rework the "repo-root" setting because less code uses it. Related-to: #66649 and #23987
67 lines
2.1 KiB
Go
67 lines
2.1 KiB
Go
/*
|
|
Copyright 2015 The Kubernetes 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.
|
|
*/
|
|
|
|
package e2e
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"k8s.io/kubernetes/test/e2e/framework"
|
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
|
"k8s.io/kubernetes/test/e2e/generated"
|
|
|
|
// test sources
|
|
_ "k8s.io/kubernetes/test/e2e/apimachinery"
|
|
_ "k8s.io/kubernetes/test/e2e/apps"
|
|
_ "k8s.io/kubernetes/test/e2e/auth"
|
|
_ "k8s.io/kubernetes/test/e2e/autoscaling"
|
|
_ "k8s.io/kubernetes/test/e2e/common"
|
|
_ "k8s.io/kubernetes/test/e2e/instrumentation"
|
|
_ "k8s.io/kubernetes/test/e2e/kubectl"
|
|
_ "k8s.io/kubernetes/test/e2e/lifecycle"
|
|
_ "k8s.io/kubernetes/test/e2e/lifecycle/bootstrap"
|
|
_ "k8s.io/kubernetes/test/e2e/network"
|
|
_ "k8s.io/kubernetes/test/e2e/node"
|
|
_ "k8s.io/kubernetes/test/e2e/scalability"
|
|
_ "k8s.io/kubernetes/test/e2e/scheduling"
|
|
_ "k8s.io/kubernetes/test/e2e/servicecatalog"
|
|
_ "k8s.io/kubernetes/test/e2e/storage"
|
|
_ "k8s.io/kubernetes/test/e2e/ui"
|
|
)
|
|
|
|
func init() {
|
|
framework.ViperizeFlags()
|
|
|
|
// TODO: Deprecating repo-root over time... instead just use gobindata_util.go , see #23987.
|
|
// Right now it is still needed, for example by
|
|
// test/e2e/framework/ingress/ingress_utils.go
|
|
// for providing the optional secret.yaml file and by
|
|
// test/e2e/framework/util.go for cluster/log-dump.
|
|
if framework.TestContext.RepoRoot != "" {
|
|
testfiles.AddFileSource(testfiles.RootFileSource{Root: framework.TestContext.RepoRoot})
|
|
}
|
|
|
|
// Enable bindata file lookup as fallback.
|
|
testfiles.AddFileSource(testfiles.BindataFileSource{
|
|
Asset: generated.Asset,
|
|
AssetNames: generated.AssetNames,
|
|
})
|
|
}
|
|
|
|
func TestE2E(t *testing.T) {
|
|
RunE2ETests(t)
|
|
}
|