mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Device Manager - Update unit tests
- Pass container to Allocate(). - Loop through containers to call Allocate() on container by container basis.
This commit is contained in:
parent
cb9fdc49db
commit
a9c6129577
@ -728,7 +728,7 @@ func TestPodContainerDeviceAllocation(t *testing.T) {
|
||||
pod := testCase.testPod
|
||||
activePods = append(activePods, pod)
|
||||
podsStub.updateActivePods(activePods)
|
||||
err := testManager.Allocate(pod)
|
||||
err := testManager.Allocate(pod, &pod.Spec.Containers[0])
|
||||
if !reflect.DeepEqual(err, testCase.expErr) {
|
||||
t.Errorf("DevicePluginManager error (%v). expected error: %v but got: %v",
|
||||
testCase.description, testCase.expErr, err)
|
||||
@ -823,7 +823,12 @@ func TestInitContainerDeviceAllocation(t *testing.T) {
|
||||
},
|
||||
}
|
||||
podsStub.updateActivePods([]*v1.Pod{podWithPluginResourcesInInitContainers})
|
||||
err = testManager.Allocate(podWithPluginResourcesInInitContainers)
|
||||
for _, container := range podWithPluginResourcesInInitContainers.Spec.InitContainers {
|
||||
err = testManager.Allocate(podWithPluginResourcesInInitContainers, &container)
|
||||
}
|
||||
for _, container := range podWithPluginResourcesInInitContainers.Spec.Containers {
|
||||
err = testManager.Allocate(podWithPluginResourcesInInitContainers, &container)
|
||||
}
|
||||
as.Nil(err)
|
||||
podUID := string(podWithPluginResourcesInInitContainers.UID)
|
||||
initCont1 := podWithPluginResourcesInInitContainers.Spec.InitContainers[0].Name
|
||||
@ -929,7 +934,7 @@ func TestDevicePreStartContainer(t *testing.T) {
|
||||
activePods := []*v1.Pod{}
|
||||
activePods = append(activePods, pod)
|
||||
podsStub.updateActivePods(activePods)
|
||||
err = testManager.Allocate(pod)
|
||||
err = testManager.Allocate(pod, &pod.Spec.Containers[0])
|
||||
as.Nil(err)
|
||||
runContainerOpts, err := testManager.GetDeviceRunContainerOptions(pod, &pod.Spec.Containers[0])
|
||||
as.Nil(err)
|
||||
|
Loading…
Reference in New Issue
Block a user