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 <fromani@redhat.com>
This commit is contained in:
Francesco Romani 2021-03-04 17:12:19 +01:00
parent da55ef0b9a
commit e930799d28

View File

@ -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"},
},
},
},
},