Adding restart kubelet flag on e2e test

This commit is contained in:
Amim Knabben 2020-12-02 18:05:22 -05:00
parent 5b8c3b90f3
commit 00da68dbc2
3 changed files with 5 additions and 1 deletions

View File

@ -221,6 +221,8 @@ type NodeTestContextType struct {
// the node e2e test. If empty, the default one (system.DefaultSpec) is
// used. The system specs are in test/e2e_node/system/specs/.
SystemSpecName string
// RestartKubelet restarts Kubelet unit when the process is killed.
RestartKubelet bool
// ExtraEnvs is a map of environment names to values.
ExtraEnvs map[string]string
}

View File

@ -80,6 +80,7 @@ func registerNodeFlags(flags *flag.FlagSet) {
// It is hard and unnecessary to deal with the complexity inside the test suite.
flags.BoolVar(&framework.TestContext.NodeConformance, "conformance", false, "If true, the test suite will not start kubelet, and fetch system log (kernel, docker, kubelet log etc.) to the report directory.")
flags.BoolVar(&framework.TestContext.PrepullImages, "prepull-images", true, "If true, prepull images so image pull failures do not cause test failures.")
flags.BoolVar(&framework.TestContext.RestartKubelet, "restart-kubelet", true, "If true, restart Kubelet unit when the process is killed.")
flags.StringVar(&framework.TestContext.ImageDescription, "image-description", "", "The description of the image which the test will be running on.")
flags.StringVar(&framework.TestContext.SystemSpecName, "system-spec-name", "", "The name of the system spec (e.g., gke) that's used in the node e2e test. The system specs are in test/e2e_node/system/specs/. This is used by the test framework to determine which tests to run for validating the system requirements.")
flags.Var(cliflag.NewMapStringString(&framework.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")

View File

@ -302,6 +302,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
}
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
restartOnExit := framework.TestContext.RestartKubelet
server := newServer(
"kubelet",
cmd,
@ -310,7 +311,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
[]string{kubeletHealthCheckURL},
"kubelet.log",
e.monitorParent,
true /* restartOnExit */)
restartOnExit)
return server, server.start()
}