Merge pull request #81488 from oomichi/move-HandleFlags

Move HandleFlags to e2e package
This commit is contained in:
Kubernetes Prow Robot 2019-08-22 17:33:33 -07:00 committed by GitHub
commit 09a4b7e257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -20,6 +20,7 @@ go_test(
"//test/e2e/cloud:go_default_library",
"//test/e2e/common:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/e2e/framework/config:go_default_library",
"//test/e2e/framework/testfiles:go_default_library",
"//test/e2e/framework/viperconfig:go_default_library",
"//test/e2e/generated:go_default_library",

View File

@ -31,6 +31,7 @@ import (
// "github.com/onsi/ginkgo"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework/config"
"k8s.io/kubernetes/test/e2e/framework/testfiles"
"k8s.io/kubernetes/test/e2e/framework/viperconfig"
"k8s.io/kubernetes/test/e2e/generated"
@ -60,9 +61,17 @@ import (
var viperConfig = flag.String("viper-config", "", "The name of a viper config file (https://github.com/spf13/viper#what-is-viper). All e2e command line parameters can also be configured in such a file. May contain a path and may or may not contain the file suffix. The default is to look for an optional file with `e2e` as base name. If a file is specified explicitly, it must be present.")
// handleFlags sets up all flags and parses the command line.
func handleFlags() {
config.CopyFlags(config.Flags, flag.CommandLine)
framework.RegisterCommonFlags(flag.CommandLine)
framework.RegisterClusterFlags(flag.CommandLine)
flag.Parse()
}
func init() {
// Register framework and test flags, then parse flags.
framework.HandleFlags()
// Register test flags, then parse flags.
handleFlags()
// Now that we know which Viper config (if any) was chosen,
// parse it and update those options which weren't already set via command line flags

View File

@ -85,7 +85,6 @@ go_library(
"//staging/src/k8s.io/client-go/tools/remotecommand:go_default_library",
"//staging/src/k8s.io/client-go/tools/watch:go_default_library",
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
"//test/e2e/framework/config:go_default_library",
"//test/e2e/framework/ginkgowrapper:go_default_library",
"//test/e2e/framework/kubelet:go_default_library",
"//test/e2e/framework/log:go_default_library",

View File

@ -33,7 +33,6 @@ import (
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/klog"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
)
@ -363,14 +362,6 @@ func RegisterNodeFlags(flags *flag.FlagSet) {
flags.Var(cliflag.NewMapStringString(&TestContext.ExtraEnvs), "extra-envs", "The extra environment variables needed for node e2e tests. Format: a list of key=value pairs, e.g., env1=val1,env2=val2")
}
// HandleFlags sets up all flags and parses the command line.
func HandleFlags() {
e2econfig.CopyFlags(e2econfig.Flags, flag.CommandLine)
RegisterCommonFlags(flag.CommandLine)
RegisterClusterFlags(flag.CommandLine)
flag.Parse()
}
func createKubeConfig(clientCfg *restclient.Config) *clientcmdapi.Config {
clusterNick := "cluster"
userNick := "user"