mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Fix selfLink issues in integration test
This commit is contained in:
parent
c7e619d4a0
commit
a486ab078f
@ -780,7 +780,7 @@ func main() {
|
|||||||
// 1 pod infra container + 2 pods from the URL +
|
// 1 pod infra container + 2 pods from the URL +
|
||||||
// 1 pod infra container + 1 pod from the service test.
|
// 1 pod infra container + 1 pod from the service test.
|
||||||
if len(createdPods) != 9 {
|
if len(createdPods) != 9 {
|
||||||
glog.Fatalf("Unexpected list of created pods:\n\n%#v\n\n%#v\n\n%#v\n\n", createdPods.List(), fakeDocker1.Created, fakeDocker2.Created)
|
glog.Fatalf("Expected 9 pods; got %v\n\nlist of created pods:\n\n%#v\n\nDocker 1 Created:\n\n%#v\n\nDocker 2 Created:\n\n%#v\n\n", len(createdPods), createdPods.List(), fakeDocker1.Created, fakeDocker2.Created)
|
||||||
}
|
}
|
||||||
glog.Infof("OK - found created pods: %#v", createdPods.List())
|
glog.Infof("OK - found created pods: %#v", createdPods.List())
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@ func init() {
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
// Convert ContainerManifest to BoundPod
|
// Convert ContainerManifest to BoundPod
|
||||||
|
//
|
||||||
|
// This function generates a dummy selfLink using the same method as the
|
||||||
|
// boundPod registry, in order for the Kubelet to work with well-formed
|
||||||
|
// boundPods during the integration test.
|
||||||
func(in *ContainerManifest, out *BoundPod, s conversion.Scope) error {
|
func(in *ContainerManifest, out *BoundPod, s conversion.Scope) error {
|
||||||
out.Spec.Containers = in.Containers
|
out.Spec.Containers = in.Containers
|
||||||
out.Spec.Volumes = in.Volumes
|
out.Spec.Volumes = in.Volumes
|
||||||
@ -47,6 +51,11 @@ func init() {
|
|||||||
out.Spec.DNSPolicy = in.DNSPolicy
|
out.Spec.DNSPolicy = in.DNSPolicy
|
||||||
out.Name = in.ID
|
out.Name = in.ID
|
||||||
out.UID = in.UUID
|
out.UID = in.UUID
|
||||||
|
|
||||||
|
if in.ID != "" {
|
||||||
|
out.SelfLink = "/api/v1beta1/boundPods/" + in.ID
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
func(in *BoundPod, out *ContainerManifest, s conversion.Scope) error {
|
func(in *BoundPod, out *ContainerManifest, s conversion.Scope) error {
|
||||||
|
@ -137,6 +137,7 @@ func TestExtractFromHTTP(t *testing.T) {
|
|||||||
UID: "111",
|
UID: "111",
|
||||||
Name: "foo" + "-" + hostname,
|
Name: "foo" + "-" + hostname,
|
||||||
Namespace: "foobar",
|
Namespace: "foobar",
|
||||||
|
SelfLink: "/api/v1beta1/boundPods/foo",
|
||||||
},
|
},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
||||||
@ -177,6 +178,7 @@ func TestExtractFromHTTP(t *testing.T) {
|
|||||||
UID: "111",
|
UID: "111",
|
||||||
Name: "foo" + "-" + hostname,
|
Name: "foo" + "-" + hostname,
|
||||||
Namespace: "foobar",
|
Namespace: "foobar",
|
||||||
|
SelfLink: "/api/v1beta1/boundPods/foo",
|
||||||
},
|
},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
||||||
@ -204,6 +206,7 @@ func TestExtractFromHTTP(t *testing.T) {
|
|||||||
UID: "111",
|
UID: "111",
|
||||||
Name: "foo" + "-" + hostname,
|
Name: "foo" + "-" + hostname,
|
||||||
Namespace: "foobar",
|
Namespace: "foobar",
|
||||||
|
SelfLink: "/api/v1beta1/boundPods/foo",
|
||||||
},
|
},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
||||||
@ -220,6 +223,7 @@ func TestExtractFromHTTP(t *testing.T) {
|
|||||||
UID: "222",
|
UID: "222",
|
||||||
Name: "bar" + "-" + hostname,
|
Name: "bar" + "-" + hostname,
|
||||||
Namespace: "foobar",
|
Namespace: "foobar",
|
||||||
|
SelfLink: "/api/v1beta1/boundPods/bar",
|
||||||
},
|
},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
RestartPolicy: api.RestartPolicy{Always: &api.RestartPolicyAlways{}},
|
||||||
|
Loading…
Reference in New Issue
Block a user