mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
add test case
This commit is contained in:
parent
eda3db550b
commit
f05d4b7f1c
@ -94,6 +94,24 @@ func TestPriorityMetadata(t *testing.T) {
|
|||||||
Tolerations: tolerations,
|
Tolerations: tolerations,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
podWithAffinityAndRequests := &v1.Pod{
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
Containers: []v1.Container{
|
||||||
|
{
|
||||||
|
Name: "container",
|
||||||
|
Image: "image",
|
||||||
|
ImagePullPolicy: "Always",
|
||||||
|
Resources: v1.ResourceRequirements{
|
||||||
|
Requests: v1.ResourceList{
|
||||||
|
v1.ResourceCPU: resource.MustParse("200m"),
|
||||||
|
v1.ResourceMemory: resource.MustParse("2000"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Affinity: podAffinity,
|
||||||
|
},
|
||||||
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
pod *v1.Pod
|
pod *v1.Pod
|
||||||
test string
|
test string
|
||||||
@ -122,6 +140,15 @@ func TestPriorityMetadata(t *testing.T) {
|
|||||||
},
|
},
|
||||||
test: "Produce a priorityMetadata with specified requests",
|
test: "Produce a priorityMetadata with specified requests",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
pod: podWithAffinityAndRequests,
|
||||||
|
expected: &priorityMetadata{
|
||||||
|
nonZeroRequest: specifiedReqs,
|
||||||
|
podTolerations: nil,
|
||||||
|
affinity: podAffinity,
|
||||||
|
},
|
||||||
|
test: "Produce a priorityMetadata with specified requests",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
ptData := PriorityMetadata(test.pod, nil)
|
ptData := PriorityMetadata(test.pod, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user