From e930799d2840a3effa15b0e309d5d04f9909d6d1 Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Thu, 4 Mar 2021 17:12:19 +0100 Subject: [PATCH] podresources: test: add test for nil Topology From https://github.com/kubernetes/kubernetes/pull/96553 we are reminded we need to handle the case on which a device plugin reports nil Topology, which is legal. Add unit test to ensure this case is handled. Signed-off-by: Francesco Romani --- pkg/kubelet/apis/podresources/server_v1_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/kubelet/apis/podresources/server_v1_test.go b/pkg/kubelet/apis/podresources/server_v1_test.go index 1f97d3d070f..3913879b7f4 100644 --- a/pkg/kubelet/apis/podresources/server_v1_test.go +++ b/pkg/kubelet/apis/podresources/server_v1_test.go @@ -177,6 +177,10 @@ func TestAllocatableResources(t *testing.T) { }, }, }, + { + ResourceName: "resource-nt", + DeviceIds: []string{"devA"}, + }, } allCPUs := []int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} @@ -230,6 +234,10 @@ func TestAllocatableResources(t *testing.T) { }, }, }, + { + ResourceName: "resource-nt", + DeviceIds: []string{"devA"}, + }, }, }, }, @@ -261,6 +269,10 @@ func TestAllocatableResources(t *testing.T) { }, }, }, + { + ResourceName: "resource-nt", + DeviceIds: []string{"devA"}, + }, }, }, },