mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Merge pull request #26323 from janetkuo/test-e2e-kubectl-images
Automatic merge from submit-queue Use gcr.io tagged images when testing Ref #20836 []()
This commit is contained in:
commit
df66b90768
@ -18,18 +18,23 @@ package framework
|
||||
|
||||
import "k8s.io/kubernetes/test/e2e/generated"
|
||||
|
||||
// ReadOrDie reads a file from gobindata. To generate gobindata, run
|
||||
//
|
||||
// # Install the program
|
||||
// go get -u github.com/jteeuwen/go-bindata/...
|
||||
//
|
||||
// # Generate the bindata file.
|
||||
// go-bindata \
|
||||
// -pkg generated -ignore .jpg -ignore .png -ignore .md \
|
||||
// ./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/*
|
||||
//
|
||||
// # Copy it into the generated directory if the results are what you expected.
|
||||
// cp bindata.go test/e2e/generated
|
||||
/*
|
||||
ReadOrDie reads a file from gobindata. To generate gobindata, run
|
||||
|
||||
# Install the program
|
||||
go get -u github.com/jteeuwen/go-bindata/...
|
||||
|
||||
# Generate the bindata file.
|
||||
go-bindata \
|
||||
-pkg generated -ignore .jpg -ignore .png -ignore .md \
|
||||
./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/*
|
||||
|
||||
# Copy it into the generated directory if the results are what you expected.
|
||||
cp bindata.go test/e2e/generated
|
||||
|
||||
# Don't forget to gofmt it
|
||||
gofmt -s -w test/e2e/generated/bindata.go
|
||||
*/
|
||||
func ReadOrDie(filePath string) []byte {
|
||||
fileBytes, err := generated.Asset(filePath)
|
||||
if err != nil {
|
||||
|
File diff suppressed because one or more lines are too long
@ -78,6 +78,8 @@ const (
|
||||
simplePodName = "nginx"
|
||||
nginxDefaultOutput = "Welcome to nginx!"
|
||||
simplePodPort = 80
|
||||
pausePodSelector = "name=pause"
|
||||
pausePodName = "pause"
|
||||
runJobTimeout = 5 * time.Minute
|
||||
busyboxImage = "gcr.io/google_containers/busybox:1.24"
|
||||
nginxImage = "gcr.io/google_containers/nginx:1.7.9"
|
||||
@ -643,14 +645,14 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
|
||||
var pod []byte
|
||||
var nsFlag string
|
||||
BeforeEach(func() {
|
||||
pod := framework.ReadOrDie("docs/user-guide/pod.yaml")
|
||||
pod = readTestFileOrDie("pause-pod.yaml")
|
||||
By("creating the pod")
|
||||
nsFlag = fmt.Sprintf("--namespace=%v", ns)
|
||||
framework.RunKubectlOrDieInput(string(pod), "create", "-f", "-", nsFlag)
|
||||
Expect(framework.CheckPodsRunningReady(c, ns, []string{simplePodName}, framework.PodStartTimeout)).To(BeTrue())
|
||||
Expect(framework.CheckPodsRunningReady(c, ns, []string{pausePodName}, framework.PodStartTimeout)).To(BeTrue())
|
||||
})
|
||||
AfterEach(func() {
|
||||
cleanupKubectlInputs(string(pod[:]), ns, simplePodSelector)
|
||||
cleanupKubectlInputs(string(pod[:]), ns, pausePodSelector)
|
||||
})
|
||||
|
||||
It("should update the label on a resource [Conformance]", func() {
|
||||
@ -658,19 +660,19 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
|
||||
labelValue := "testing-label-value"
|
||||
|
||||
By("adding the label " + labelName + " with value " + labelValue + " to a pod")
|
||||
framework.RunKubectlOrDie("label", "pods", simplePodName, labelName+"="+labelValue, nsFlag)
|
||||
framework.RunKubectlOrDie("label", "pods", pausePodName, labelName+"="+labelValue, nsFlag)
|
||||
By("verifying the pod has the label " + labelName + " with the value " + labelValue)
|
||||
output := framework.RunKubectlOrDie("get", "pod", simplePodName, "-L", labelName, nsFlag)
|
||||
output := framework.RunKubectlOrDie("get", "pod", pausePodName, "-L", labelName, nsFlag)
|
||||
if !strings.Contains(output, labelValue) {
|
||||
framework.Failf("Failed updating label " + labelName + " to the pod " + simplePodName)
|
||||
framework.Failf("Failed updating label " + labelName + " to the pod " + pausePodName)
|
||||
}
|
||||
|
||||
By("removing the label " + labelName + " of a pod")
|
||||
framework.RunKubectlOrDie("label", "pods", simplePodName, labelName+"-", nsFlag)
|
||||
framework.RunKubectlOrDie("label", "pods", pausePodName, labelName+"-", nsFlag)
|
||||
By("verifying the pod doesn't have the label " + labelName)
|
||||
output = framework.RunKubectlOrDie("get", "pod", simplePodName, "-L", labelName, nsFlag)
|
||||
output = framework.RunKubectlOrDie("get", "pod", pausePodName, "-L", labelName, nsFlag)
|
||||
if strings.Contains(output, labelValue) {
|
||||
framework.Failf("Failed removing label " + labelName + " of the pod " + simplePodName)
|
||||
framework.Failf("Failed removing label " + labelName + " of the pod " + pausePodName)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
12
test/e2e/testing-manifests/kubectl/pause-pod.yaml
Normal file
12
test/e2e/testing-manifests/kubectl/pause-pod.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: pause
|
||||
labels:
|
||||
name: pause
|
||||
spec:
|
||||
containers:
|
||||
- name: pause
|
||||
image: gcr.io/google-containers/pause:2.0
|
||||
ports:
|
||||
- containerPort: 80
|
Loading…
Reference in New Issue
Block a user