Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func (mnlp ManageNVLinkLogicalPartition) UpdateNVLinkLogicalPartitionsInDB(ctx c

// Update status if necessary
if controllerNvllp.Status != nil {
if nvllp.Status == cdbm.NVLinkLogicalPartitionStatusDeleting {
continue
}

var mapped cdbm.NVLinkLogicalPartitionStatus
mapped.FromProto(controllerNvllp.Status.State)
if mapped != "" && mapped != nvllp.Status {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,15 @@ func TestManageNVLinkLogicalPartition_UpdateNVLinkLogicalPartitionsInDB(t *testi
}

tests := []struct {
name string
fields fields
args args
updatedNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
readyNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
deletedNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
missingNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
restoredNVLinkLogicalPartition *cdbm.NVLinkLogicalPartition
name string
fields fields
args args
updatedNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
readyNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
deletedNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
missingNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
deletingNVLinkLogicalPartitions []*cdbm.NVLinkLogicalPartition
restoredNVLinkLogicalPartition *cdbm.NVLinkLogicalPartition

wantErr bool
}{
Expand Down Expand Up @@ -331,10 +332,11 @@ func TestManageNVLinkLogicalPartition_UpdateNVLinkLogicalPartitionsInDB(t *testi
},
},
},
updatedNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp1, nvllp3},
deletedNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp5, nvllp6},
missingNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp7, nvllp11},
restoredNVLinkLogicalPartition: nvllp8,
updatedNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp1},
deletedNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp5, nvllp6},
missingNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp7, nvllp11},
deletingNVLinkLogicalPartitions: []*cdbm.NVLinkLogicalPartition{nvllp3},
restoredNVLinkLogicalPartition: nvllp8,
wantErr: false,
},
{
Expand Down Expand Up @@ -455,6 +457,11 @@ func TestManageNVLinkLogicalPartition_UpdateNVLinkLogicalPartitionsInDB(t *testi
assert.Equal(t, cdbm.NVLinkLogicalPartitionStatusError, uv.Status)
}

for _, nvllp := range tt.deletingNVLinkLogicalPartitions {
uv, _ := nvllpDAO.GetByID(ctx, nil, nvllp.ID, nil)
assert.Equal(t, cdbm.NVLinkLogicalPartitionStatusDeleting, uv.Status, "Deleting status should not be overwritten by inventory")
}

if tt.restoredNVLinkLogicalPartition != nil {
rv, _ := nvllpDAO.GetByID(ctx, nil, tt.restoredNVLinkLogicalPartition.ID, nil)
assert.False(t, rv.IsMissingOnSite)
Expand Down