mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Add additional tests to DRAManager checkpointing
Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
fd7370b84d
commit
569ed33d78
@ -49,23 +49,69 @@ func TestCheckpointGetOrCreate(t *testing.T) {
|
|||||||
[]ClaimInfoState{},
|
[]ClaimInfoState{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Restore valid checkpoint",
|
"Restore checkpoint - single claim",
|
||||||
`{"version":"v1","entries":[{"DriverName":"test-driver.cdi.k8s.io","ClaimUID":"067798be-454e-4be4-9047-1aa06aea63f7","ClaimName":"example","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver.cdi.k8s.io":["example.com/example=cdi-example"]}}],"checksum":1988120167}`,
|
`{"version":"v1","entries":[{"DriverName":"test-driver.cdi.k8s.io","ClaimUID":"067798be-454e-4be4-9047-1aa06aea63f7","ClaimName":"example","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver.cdi.k8s.io":["example.com/example=cdi-example"]}}],"checksum":1988120167}`,
|
||||||
"",
|
"",
|
||||||
[]ClaimInfoState{{
|
[]ClaimInfoState{
|
||||||
DriverName: "test-driver.cdi.k8s.io",
|
{
|
||||||
ClaimUID: "067798be-454e-4be4-9047-1aa06aea63f7",
|
DriverName: "test-driver.cdi.k8s.io",
|
||||||
ClaimName: "example",
|
ClaimUID: "067798be-454e-4be4-9047-1aa06aea63f7",
|
||||||
Namespace: "default",
|
ClaimName: "example",
|
||||||
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
|
Namespace: "default",
|
||||||
CDIDevices: map[string][]string{
|
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
|
||||||
"test-driver.cdi.k8s.io": {"example.com/example=cdi-example"},
|
CDIDevices: map[string][]string{
|
||||||
|
"test-driver.cdi.k8s.io": {"example.com/example=cdi-example"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Restore checkpoint with invalid checksum",
|
"Restore checkpoint - single claim - multiple devices",
|
||||||
|
`{"version":"v1","entries":[{"DriverName":"meta-test-driver.cdi.k8s.io","ClaimUID":"067798be-454e-4be4-9047-1aa06aea63f7","ClaimName":"example","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver-1.cdi.k8s.io":["example-1.com/example-1=cdi-example-1"],"test-driver-2.cdi.k8s.io":["example-2.com/example-2=cdi-example-2"]}}],"checksum":2113538068}`,
|
||||||
|
"",
|
||||||
|
[]ClaimInfoState{
|
||||||
|
{
|
||||||
|
DriverName: "meta-test-driver.cdi.k8s.io",
|
||||||
|
ClaimUID: "067798be-454e-4be4-9047-1aa06aea63f7",
|
||||||
|
ClaimName: "example",
|
||||||
|
Namespace: "default",
|
||||||
|
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
|
||||||
|
CDIDevices: map[string][]string{
|
||||||
|
"test-driver-1.cdi.k8s.io": {"example-1.com/example-1=cdi-example-1"},
|
||||||
|
"test-driver-2.cdi.k8s.io": {"example-2.com/example-2=cdi-example-2"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Restore checkpoint - multiple claims",
|
||||||
|
`{"version":"v1","entries":[{"DriverName":"test-driver.cdi.k8s.io","ClaimUID":"067798be-454e-4be4-9047-1aa06aea63f7","ClaimName":"example-1","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver.cdi.k8s.io":["example.com/example=cdi-example-1"]}},{"DriverName":"test-driver.cdi.k8s.io","ClaimUID":"4cf8db2d-06c0-7d70-1a51-e59b25b2c16c","ClaimName":"example-2","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver.cdi.k8s.io":["example.com/example=cdi-example-2"]}}],"checksum":666680545}`,
|
||||||
|
"",
|
||||||
|
[]ClaimInfoState{
|
||||||
|
{
|
||||||
|
DriverName: "test-driver.cdi.k8s.io",
|
||||||
|
ClaimUID: "067798be-454e-4be4-9047-1aa06aea63f7",
|
||||||
|
ClaimName: "example-1",
|
||||||
|
Namespace: "default",
|
||||||
|
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
|
||||||
|
CDIDevices: map[string][]string{
|
||||||
|
"test-driver.cdi.k8s.io": {"example.com/example=cdi-example-1"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
DriverName: "test-driver.cdi.k8s.io",
|
||||||
|
ClaimUID: "4cf8db2d-06c0-7d70-1a51-e59b25b2c16c",
|
||||||
|
ClaimName: "example-2",
|
||||||
|
Namespace: "default",
|
||||||
|
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
|
||||||
|
CDIDevices: map[string][]string{
|
||||||
|
"test-driver.cdi.k8s.io": {"example.com/example=cdi-example-2"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Restore checkpoint - invalid checksum",
|
||||||
`{"version":"v1","entries":[{"DriverName":"test-driver.cdi.k8s.io","ClaimUID":"067798be-454e-4be4-9047-1aa06aea63f7","ClaimName":"example","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver.cdi.k8s.io":["example.com/example=cdi-example"]}}],"checksum":1988120168}`,
|
`{"version":"v1","entries":[{"DriverName":"test-driver.cdi.k8s.io","ClaimUID":"067798be-454e-4be4-9047-1aa06aea63f7","ClaimName":"example","Namespace":"default","PodUIDs":{"139cdb46-f989-4f17-9561-ca10cfb509a6":{}},"CDIDevices":{"test-driver.cdi.k8s.io":["example.com/example=cdi-example"]}}],"checksum":1988120168}`,
|
||||||
"checkpoint is corrupted",
|
"checkpoint is corrupted",
|
||||||
[]ClaimInfoState{},
|
[]ClaimInfoState{},
|
||||||
|
Loading…
Reference in New Issue
Block a user