e2e:podresources: verify count for terminal pods
PodResourcesAPI reports in the List call about resources of pods in terminal phase. The internal managers reassign resources assigned to pods in terminal phase, so podresources should ignore them. Whether this behavior intended or not (the docs are not unequivocal) this e2e test demonstrates and verifies the mentioned above. Signed-off-by: Talor Itzhak <titzhak@redhat.com>
This commit is contained in:
@@ -702,6 +702,27 @@ var _ = SIGDescribe("POD Resources [Serial] [Feature:PodResources][NodeFeature:P
|
|||||||
podresourcesListTests(ctx, f, cli, nil)
|
podresourcesListTests(ctx, f, cli, nil)
|
||||||
podresourcesGetAllocatableResourcesTests(ctx, cli, nil, onlineCPUs, reservedSystemCPUs)
|
podresourcesGetAllocatableResourcesTests(ctx, cli, nil, onlineCPUs, reservedSystemCPUs)
|
||||||
})
|
})
|
||||||
|
ginkgo.It("should account for resources of pods in terminal phase", func(ctx context.Context) {
|
||||||
|
pd := podDesc{
|
||||||
|
cntName: "e2e-test-cnt",
|
||||||
|
podName: "e2e-test-pod",
|
||||||
|
cpuRequest: 1000,
|
||||||
|
}
|
||||||
|
pod := makePodResourcesTestPod(pd)
|
||||||
|
pod.Spec.Containers[0].Command = []string{"sh", "-c", "/bin/true"}
|
||||||
|
pod = e2epod.NewPodClient(f).CreateSync(ctx, pod)
|
||||||
|
defer e2epod.NewPodClient(f).DeleteSync(ctx, pod.Name, metav1.DeleteOptions{}, time.Minute)
|
||||||
|
err := e2epod.WaitForPodCondition(ctx, f.ClientSet, pod.Namespace, pod.Name, "Pod Succeeded", time.Minute*2, testutils.PodSucceeded)
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
endpoint, err := util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
cli, conn, err := podresources.GetV1Client(endpoint, defaultPodResourcesTimeout, defaultPodResourcesMaxSize)
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
defer conn.Close()
|
||||||
|
// although the pod moved into terminal state, PodResourcesAPI still list its cpus
|
||||||
|
expectPodResources(ctx, 1, cli, []podDesc{pd})
|
||||||
|
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user