mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Converted test in pods suite to use native Go definition of the api.Pod #4070
This commit is contained in:
parent
e9bf484f17
commit
50467043d5
@ -42,12 +42,36 @@ var _ = Describe("Pods", func() {
|
|||||||
It("should be submitted and removed", func() {
|
It("should be submitted and removed", func() {
|
||||||
podClient := c.Pods(api.NamespaceDefault)
|
podClient := c.Pods(api.NamespaceDefault)
|
||||||
|
|
||||||
By("loading the pod json")
|
By("creating the pod")
|
||||||
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.Name = pod.Name + "-" + randomSuffix()
|
pod := &api.Pod{
|
||||||
pod.Labels["time"] = value
|
ObjectMeta: api.ObjectMeta{
|
||||||
pod.Spec.Containers[0].Ports[0].HostPort = 0
|
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}},
|
||||||
|
LivenessProbe: &api.Probe{
|
||||||
|
Handler: api.Handler{
|
||||||
|
HTTPGet: &api.HTTPGetAction{
|
||||||
|
Path: "/index.html",
|
||||||
|
Port: util.NewIntOrStringFromInt(8080),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
InitialDelaySeconds: 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
By("submitting the pod to kubernetes")
|
By("submitting the pod to kubernetes")
|
||||||
_, err := podClient.Create(pod)
|
_, err := podClient.Create(pod)
|
||||||
|
Loading…
Reference in New Issue
Block a user