mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #3995 from filbranden/e2e_pod_update_remove_external_json
Convert load of api/examples/pod.json into native Go definition of the api.Pod
This commit is contained in:
commit
6d5c56b2a7
@ -51,7 +51,6 @@ readonly KUBE_TEST_TARGETS=(
|
|||||||
readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
|
readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
|
||||||
readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
|
readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
|
||||||
readonly KUBE_TEST_PORTABLE=(
|
readonly KUBE_TEST_PORTABLE=(
|
||||||
api/examples/pod.json
|
|
||||||
contrib/for-tests/network-tester/rc.json
|
contrib/for-tests/network-tester/rc.json
|
||||||
contrib/for-tests/network-tester/service.json
|
contrib/for-tests/network-tester/service.json
|
||||||
hack/e2e.go
|
hack/e2e.go
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -32,10 +33,35 @@ import (
|
|||||||
func TestPodUpdate(c *client.Client) bool {
|
func TestPodUpdate(c *client.Client) bool {
|
||||||
podClient := c.Pods(api.NamespaceDefault)
|
podClient := c.Pods(api.NamespaceDefault)
|
||||||
|
|
||||||
pod := loadPodOrDie(assetPath("api", "examples", "pod.json"))
|
name := "pod-update-" + string(util.NewUUID())
|
||||||
value := strconv.Itoa(time.Now().Nanosecond())
|
value := strconv.Itoa(time.Now().Nanosecond())
|
||||||
pod.Labels["time"] = value
|
pod := &api.Pod{
|
||||||
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
Name: name,
|
||||||
|
Labels: map[string]string{
|
||||||
|
"name": "foo",
|
||||||
|
"time": value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Spec: api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Name: "nginx",
|
||||||
|
Image: "dockerfile/nginx",
|
||||||
|
Ports: []api.Port{{ContainerPort: 80, HostPort: 8080}},
|
||||||
|
LivenessProbe: &api.Probe{
|
||||||
|
Handler: api.Handler{
|
||||||
|
HTTPGet: &api.HTTPGetAction{
|
||||||
|
Path: "/index.html",
|
||||||
|
Port: util.NewIntOrStringFromInt(8080),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
InitialDelaySeconds: 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
_, err := podClient.Create(pod)
|
_, err := podClient.Create(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to create pod: %v", err)
|
glog.Errorf("Failed to create pod: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user