Rename CdiDevices to CDIDevices in dramanager checkpoint

Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
Kevin Klues 2023-03-12 18:35:03 +00:00
parent d34b0275a3
commit 273a8ffad1
2 changed files with 7 additions and 7 deletions

View File

@ -51,9 +51,9 @@ type ClaimInfoState struct {
// PodUIDs is a set of pod UIDs that reference a resource // PodUIDs is a set of pod UIDs that reference a resource
PodUIDs sets.Set[string] PodUIDs sets.Set[string]
// CdiDevices is a list of CDI devices returned by the // CDIDevices is a list of CDI devices returned by the
// GRPC API call NodePrepareResource // GRPC API call NodePrepareResource
CdiDevices []string CDIDevices []string
} }
type stateCheckpoint struct { type stateCheckpoint struct {

View File

@ -50,7 +50,7 @@ func TestCheckpointGetOrCreate(t *testing.T) {
}, },
{ {
"Restore valid checkpoint", "Restore valid checkpoint",
`{"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":["example.com/example=cdi-example"]}],"checksum":2939981547}`, `{"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":["example.com/example=cdi-example"]}],"checksum":2242470059}`,
"", "",
[]ClaimInfoState{{ []ClaimInfoState{{
DriverName: "test-driver.cdi.k8s.io", DriverName: "test-driver.cdi.k8s.io",
@ -58,13 +58,13 @@ func TestCheckpointGetOrCreate(t *testing.T) {
ClaimName: "example", ClaimName: "example",
Namespace: "default", Namespace: "default",
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"), PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
CdiDevices: []string{"example.com/example=cdi-example"}, CDIDevices: []string{"example.com/example=cdi-example"},
}, },
}, },
}, },
{ {
"Restore checkpoint with invalid checksum", "Restore checkpoint with 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":["example.com/example=cdi-example"]}],"checksum":2939981548}`, `{"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":["example.com/example=cdi-example"]}],"checksum":2242470060}`,
"checkpoint is corrupted", "checkpoint is corrupted",
[]ClaimInfoState{}, []ClaimInfoState{},
}, },
@ -123,10 +123,10 @@ func TestCheckpointStateStore(t *testing.T) {
ClaimName: "example", ClaimName: "example",
Namespace: "default", Namespace: "default",
PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"), PodUIDs: sets.New("139cdb46-f989-4f17-9561-ca10cfb509a6"),
CdiDevices: []string{"example.com/example=cdi-example"}, CDIDevices: []string{"example.com/example=cdi-example"},
} }
expectedCheckpoint := `{"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":["example.com/example=cdi-example"]}],"checksum":2939981547}` expectedCheckpoint := `{"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":["example.com/example=cdi-example"]}],"checksum":2242470059}`
// create temp dir // create temp dir
testingDir, err := os.MkdirTemp("", "dramanager_state_test") testingDir, err := os.MkdirTemp("", "dramanager_state_test")