@@ -34,147 +34,187 @@ Documentation for other releases can be found at
34
34
35
35
# Node End-To-End tests
36
36
37
- Node e2e tests start kubelet and minimal supporting infrastructure to validate
38
- the kubelet on a host. Tests can be run either locally, against a remote host or
39
- against a GCE image.
37
+ Node e2e tests are component tests meant for testing the Kubelet code on a custom host environment.
38
+
39
+ Tests can be run either locally or against a host running on GCE.
40
+
41
+ Node e2e tests are run as both pre- and post- submit tests by the Kubernetes project.
40
42
41
43
* Note: Linux only. Mac and Windows unsupported.*
42
44
43
- ## Running tests locally
45
+ # Running tests
44
46
45
- etcd must be installed and on the PATH to run the node e2e tests. To verify
46
- etcd is installed: ` which etcd ` . You can find instructions for installing etcd
47
- [ on the etcd releases page] ( https://github.com/coreos/etcd/releases ) .
47
+ ## Locally
48
48
49
- Run the tests locally: ` make test_e2e_node `
49
+ Why run tests * Locally * ? Much faster than running tests Remotely.
50
50
51
- Running the node e2e tests locally will build the kubernetes go source files and
52
- then start the kubelet, kube-apiserver, and etcd binaries on localhost before
53
- executing the ginkgo tests under test/e2e_node against the local kubelet
54
- instance.
51
+ Prerequisites:
52
+ - [ Install etcd] ( https://github.com/coreos/etcd/releases ) on your PATH
53
+ - Verify etcd is installed correctly by running ` which etcd `
54
+ - [ Install ginkgo] ( https://github.com/onsi/ginkgo ) on your PATH
55
+ - Verify ginkgo is installed correctly by running ` which ginkgo `
55
56
56
- ## Running tests against a remote host
57
+ From the Kubernetes base directory, run:
57
58
58
- The node e2e tests can be run against one or more remote hosts using one of:
59
- * [ e2e-node-jenkins.sh] ( ../../test/e2e_node/jenkins/e2e-node-jenkins.sh ) (gce
60
- only)
61
- * [ run_e2e.go] ( ../../test/e2e_node/runner/run_e2e.go ) (requires passwordless ssh
62
- and remote passwordless sudo access over ssh)
63
- * using [ run_e2e.go] ( ../../test/e2e_node/runner/run_e2e.go ) to build a tar.gz
64
- and executing on host (requires host access w/ remote sudo)
59
+ ``` sh
60
+ make test_e2e_node
61
+ ```
65
62
66
- ### Option 1: Configuring a new remote host from scratch for testing
63
+ This will: run the * ginkgo* binary against the subdirectory * test/e2e_node* , which will in turn:
64
+ - Ask for sudo access (needed for running some of the processes)
65
+ - Build the Kubernetes source code
66
+ - Pre-pull docker images used by the tests
67
+ - Start a local instance of * etcd*
68
+ - Start a local instance of * kube-apiserver*
69
+ - Start a local instance of * kubelet*
70
+ - Run the test using the locally started processes
71
+ - Output the test results to STDOUT
72
+ - Stop * kubelet* , * kube-apiserver* , and * etcd*
67
73
68
- The host must contain an environment capable of running a minimal kubernetes cluster
69
- consisting of etcd, the kube-apiserver, and kubelet. The steps required to step a host vary between distributions
70
- (coreos, rhel, ubuntu, etc), but may include:
71
- * install etcd
72
- * install docker
73
- * add user running tests to docker group
74
- * install lxc and update grub commandline
75
- * enable tty-less sudo access
74
+ ## Remotely
76
75
77
- These steps should be captured in [ setup_host.sh] ( ../../test/e2e_node/environment/setup_host.sh )
76
+ Why Run tests * Remotely* ? Tests will be run in a customized pristine environment. Closely mimics what will be done
77
+ as pre- and post- submit testing performed by the project.
78
78
79
- ### Option 2: Copying an existing host image from another project
79
+ Prerequisites:
80
+ - [ join the googlegroup] ( https://groups.google.com/forum/#!forum/kubernetes-dev )
81
+
82
+ - * This provides read access to the node test images.*
83
+ - Setup a [ Google Cloud Platform] ( https://cloud.google.com/ ) account and project with Google Compute Engine enabled
84
+ - Install and setup the [ gcloud sdk] ( https://cloud.google.com/sdk/downloads )
85
+ - Verify the sdk is setup correctly by running ` gcloud compute instances list ` and ` gcloud compute images list --project kubernetes-node-e2e-images `
80
86
81
- If there is an existing image in another project you would like to use, you can use the script
82
- [ copy-e2e-image.sh] ( ../../test/e2e_node/jenkins/copy-e2e-image.sh ) to copy an image
83
- from one GCE project to another.
87
+ Run:
84
88
85
89
``` sh
86
- copy-e2e-image.sh < image-to-be-copied-name > < from-gce-project > < to-gce-project >
90
+ make test_e2e_node REMOTE=true
87
91
```
88
92
89
- ### Running the tests
93
+ This will:
94
+ - Build the Kubernetes source code
95
+ - Create a new GCE instance using the default test image
96
+ - Instance will be called ** test-e2e-node-containervm-v20160321-image**
97
+ - Lookup the instance public ip address
98
+ - Copy a compressed archive file to the host containing the following binaries:
99
+ - ginkgo
100
+ - kubelet
101
+ - kube-apiserver
102
+ - e2e_node.test (this binary contains the actual tests to be run)
103
+ - Unzip the archive to a directory under ** /tmp/gcloud**
104
+ - Run the tests using the ` ginkgo ` command
105
+ - Starts etcd, kube-apiserver, kubelet
106
+ - The ginkgo command is used because this supports more features than running the test binary directly
107
+ - Output the remote test results to STDOUT
108
+ - ` scp ` the log files back to the local host under /tmp/_ artifacts/e2e-node-containervm-v20160321-image
109
+ - Stop the processes on the remote host
110
+ - ** Leave the GCE instance running**
90
111
91
- 1 . If running tests against a running host on gce
112
+ ** Note: Subsequent tests run using the same image will * reuse the existing host* instead of deleting it and
113
+ provisioning a new one. To delete the GCE instance after each test see
114
+ * [ DELETE_INSTANCE] ( #delete-instance-after-tests-run ) * .**
92
115
93
- * Make sure host names are resolvable to ssh by running ` gcloud compute config-ssh ` to
94
- update ~ /.ssh/config with the GCE hosts. After running this command, check the hostnames
95
- in the ~ /.ssh/config file and verify you have the correct access by running ` ssh <host> ` .
96
116
97
- * Copy [ template.properties ] ( ../../test/e2e_node/jenkins/template.properties )
117
+ # Additional Remote Options
98
118
99
- * Fill in ` GCE_HOSTS ` with the name of the host
119
+ ## Run tests using different images
100
120
101
- * Run ` test/e2e_node/jenkins/e2e-node-jenkins.sh <path to properties file> `
102
- * ** Must be run from kubernetes root **
121
+ This is useful if you want to run tests against a host using a different OS distro or container runtime than
122
+ provided by the default image.
103
123
104
- 2 . If running against a host anywhere else
124
+ List the available test images using gcloud.
105
125
106
- * ** Requires password-less ssh and sudo access**
126
+ ``` sh
127
+ make test_e2e_node LIST_IMAGES=true
128
+ ```
107
129
108
- * Make sure this works - e.g. ` ssh <hostname> -- sudo echo "ok" `
109
- * If ssh flags are required (e.g. ` -i ` ), they can be used and passed to the
110
- tests with ` --ssh-options `
130
+ This will output a list of the available images for the default image project.
111
131
112
- * `go run test/e2e_node/runner/run_e2e.go --logtostderr --hosts <comma
113
- separated hosts>`
132
+ Then run:
114
133
115
- * **Must be run from kubernetes root**
134
+ ``` sh
135
+ make test_e2e_node REMOTE=true IMAGES=" <comma-separated-list-images>"
136
+ ```
116
137
117
- 3 . Alternatively, manually build and copy ` e2e_node_test.tar.gz ` to a remote
118
- host
138
+ ## Run tests against a running GCE instance (not an image)
119
139
120
- * Build the tar.gz `go run test/e2e_node/runner/run_e2e.go --logtostderr
121
- --build-only`
140
+ This is useful if you have an host instance running already and want to run the tests there instead of on a new instance.
122
141
123
- * Copy ` e2e_node_test.tar.gz ` to the remote host
142
+ ``` sh
143
+ make test_e2e_node REMOTE=true HOSTS=" <comma-separated-list-of-hostnames>"
144
+ ```
124
145
125
- * Extract the archive on the remote host ` tar -xzvf e2e_node_test.tar.gz `
146
+ ## Delete instance after tests run
126
147
127
- * Run the tests `./e2e_node.test --logtostderr --vmodule=* =2
128
- --build-services=false --node-name=<hostname >`
148
+ This is useful if you want recreate the instance for each test run to trigger flakes related to starting the instance.
129
149
130
- * Note: This must be run from the directory containing the kubelet and
131
- kube-apiserver binaries.
150
+ ``` sh
151
+ make test_e2e_node REMOTE=true DELETE_INSTANCES=true
152
+ ```
132
153
133
- ## Running tests against a gce image
154
+ ## Keep instance, test binaries, and * processes * around after tests run
134
155
135
- * Option 1: Build a gce image from a prepared gce host
136
- * Create the host from a base image and configure it (see above)
137
- * Run tests against this remote host to ensure that it is setup correctly
138
- before doing anything else
139
- * Create a gce * snapshot* of the instance
140
- * Create a gce * disk* from the snapshot
141
- * Create a gce * image* from the disk
142
- * Option 2: Copy a prepared image from another project
143
- * Instructions above
144
- * Test that the necessary gcloud credentials are setup for the project
145
- * ` gcloud compute --project <project> --zone <zone> images list `
146
- * Verify that your image appears in the list
147
- * Copy [ template.properties] ( ../../test/e2e_node/jenkins/template.properties )
148
- * Fill in ` GCE_PROJECT ` , ` GCE_ZONE ` , ` GCE_IMAGES `
149
- * Run ` test/e2e_node/jenkins/e2e-node-jenkins.sh <path to properties file> `
150
- * ** Must be run from kubernetes root**
156
+ This is useful if you want to manually inspect or debug the kubelet process run as part of the tests.
151
157
152
- ## Kubernetes Jenkins CI and PR builder
158
+ ``` sh
159
+ make test_e2e_node REMOTE=true CLEANUP=false
160
+ ```
153
161
154
- Node e2e tests are run against a static list of host environments continuously
155
- or when manually triggered on a github.com pull requests using the trigger
156
- phrase ` @k8s-bot test node e2e `
162
+ ## Run tests using an image in another project
157
163
158
- ### CI Host environments
164
+ This is useful if you want to create your own host image in another project and use it for testing.
159
165
160
- TBD
166
+ ``` sh
167
+ make test_e2e_node REMOTE=true IMAGE_PROJECT=" <name-of-project-with-images>" IMAGES=" <image-name>"
168
+ ```
161
169
162
- ### PR builder host environments
170
+ Setting up your own host image may require additional steps such as installing etcd or docker. See
171
+ [ setup_host.sh] ( ../../test/e2e_node/environment/setup_host.sh ) for common steps to setup hosts to run node tests.
163
172
164
- | linux distro | distro version | docker version | etcd version | cloud provider |
165
- | -----------------| ----------------| ----------------| --------------| ----------------|
166
- | containervm | | 1.8 | | gce |
167
- | coreos | stable | 1.8 | | gce |
168
- | debian | jessie | 1.10 | | gce |
169
- | ubuntu | trusty | 1.8 | | gce |
170
- | ubuntu | trusty | 1.9 | | gce |
171
- | ubuntu | trusty | 1.10 | | gce |
173
+ ## Create instances using a different instance name prefix
172
174
175
+ This is useful if you want to create instances using a different name so that you can run multiple copies of the
176
+ test in parallel against different instances of the same image.
173
177
178
+ ``` sh
179
+ make test_e2e_node REMOTE=true INSTANCE_PREFIX=" my-prefix"
180
+ ```
181
+
182
+ # Additional Test Options for both Remote and Local execution
183
+
184
+ ## Only run a subset of the tests
185
+
186
+ To run tests matching a regex:
187
+
188
+ ``` sh
189
+ make test_e2e_node REMOTE=true FOCUS=" <regex-to-match>"
190
+ ```
191
+
192
+ To run tests NOT matching a regex:
193
+
194
+ ``` sh
195
+ make test_e2e_node REMOTE=true SKIP=" <regex-to-match>"
196
+ ```
197
+
198
+ ## Run tests continually until they fail
199
+
200
+ This is useful if you are trying to debug a flaky test failure. This will cause ginkgo to continually
201
+ run the tests until they fail. ** Note: this will only perform test setup once (e.g. creating the instance) and is
202
+ less useful for catching flakes related creating the instance from an image.**
203
+
204
+ ``` sh
205
+ make test_e2e_node REMOTE=true RUN_UNTIL_FAILURE=true
206
+ ```
174
207
208
+ # Notes on tests run by the Kubernetes project during pre-, post- submit.
175
209
210
+ The node e2e tests are run by the PR builder for each Pull Request and the results published at
211
+ the bottom of the comments section. To re-run just the node e2e tests from the PR builder add the comment
212
+ ` @k8s-bot node e2e test this issue: #<Flake-Issue-Number or IGNORE> ` and ** include a link to the test
213
+ failure logs if caused by a flake.**
176
214
215
+ The PR builder runs tests against the images listed in [ jenkins-pull.properties] ( ../../test/e2e_node/jenkins/jenkins-pull.properties )
177
216
217
+ The post submit tests run against the images listed in [ jenkins-ci.properties] ( ../../test/e2e_node/jenkins/jenkins-ci.properties )
178
218
179
219
180
220
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
0 commit comments