Skip to content

Commit c76291b

Browse files
author
Kenichi Omichi
committed
Move HandleFlags to e2e package
HandleFlags() was used at e2e package and it depends on sub e2e framework "config" in core e2e framework. That was invalid dependency. So this moves HandleFlags() to e2e package for simple dependency.
1 parent 9b54021 commit c76291b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

test/e2e/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ go_test(
2020
"//test/e2e/cloud:go_default_library",
2121
"//test/e2e/common:go_default_library",
2222
"//test/e2e/framework:go_default_library",
23+
"//test/e2e/framework/config:go_default_library",
2324
"//test/e2e/framework/testfiles:go_default_library",
2425
"//test/e2e/framework/viperconfig:go_default_library",
2526
"//test/e2e/generated:go_default_library",

test/e2e/e2e_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
// "github.com/onsi/ginkgo"
3232

3333
"k8s.io/kubernetes/test/e2e/framework"
34+
"k8s.io/kubernetes/test/e2e/framework/config"
3435
"k8s.io/kubernetes/test/e2e/framework/testfiles"
3536
"k8s.io/kubernetes/test/e2e/framework/viperconfig"
3637
"k8s.io/kubernetes/test/e2e/generated"
@@ -60,9 +61,17 @@ import (
6061

6162
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.")
6263

64+
// handleFlags sets up all flags and parses the command line.
65+
func handleFlags() {
66+
config.CopyFlags(config.Flags, flag.CommandLine)
67+
framework.RegisterCommonFlags(flag.CommandLine)
68+
framework.RegisterClusterFlags(flag.CommandLine)
69+
flag.Parse()
70+
}
71+
6372
func init() {
64-
// Register framework and test flags, then parse flags.
65-
framework.HandleFlags()
73+
// Register test flags, then parse flags.
74+
handleFlags()
6675

6776
// Now that we know which Viper config (if any) was chosen,
6877
// parse it and update those options which weren't already set via command line flags

test/e2e/framework/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ go_library(
8484
"//staging/src/k8s.io/client-go/tools/remotecommand:go_default_library",
8585
"//staging/src/k8s.io/client-go/tools/watch:go_default_library",
8686
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
87-
"//test/e2e/framework/config:go_default_library",
8887
"//test/e2e/framework/ginkgowrapper:go_default_library",
8988
"//test/e2e/framework/kubelet:go_default_library",
9089
"//test/e2e/framework/log:go_default_library",

test/e2e/framework/test_context.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
cliflag "k8s.io/component-base/cli/flag"
3434
"k8s.io/klog"
3535
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
36-
e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
3736
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
3837
)
3938

@@ -363,14 +362,6 @@ func RegisterNodeFlags(flags *flag.FlagSet) {
363362
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")
364363
}
365364

366-
// HandleFlags sets up all flags and parses the command line.
367-
func HandleFlags() {
368-
e2econfig.CopyFlags(e2econfig.Flags, flag.CommandLine)
369-
RegisterCommonFlags(flag.CommandLine)
370-
RegisterClusterFlags(flag.CommandLine)
371-
flag.Parse()
372-
}
373-
374365
func createKubeConfig(clientCfg *restclient.Config) *clientcmdapi.Config {
375366
clusterNick := "cluster"
376367
userNick := "user"

0 commit comments

Comments
 (0)