Skip to content

Commit

Permalink
[controller] Add more test cases (#23)
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Zimin <[email protected]>
  • Loading branch information
AleksZimin authored Feb 16, 2024
1 parent fd1c9b3 commit 1e67759
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions images/agent/pkg/controller/block_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func TestBlockDeviceCtrl(t *testing.T) {
testLsblkOutputBytes := []byte(testLsblkOutput)
devices, err := utils.UnmarshalDevices(testLsblkOutputBytes)
if assert.NoError(t, err) {
assert.Equal(t, 26, len(devices))
assert.Equal(t, 28, len(devices))
}
filteredDevices, err := FilterDevices(*log, devices)

Expand Down Expand Up @@ -252,12 +252,17 @@ func TestBlockDeviceCtrl(t *testing.T) {
assert.False(t, candidate.Consumable)
candidateName := CreateCandidateName(*log, candidate)
assert.Equal(t, "dev-377bc6adf33d84eb5932f5c89798bb6c5949ae2d", candidateName, "device name generated incorrectly")
case 5:
assert.Equal(t, "/dev/vdc1", device.Name)
assert.True(t, candidate.Consumable)
candidateName := CreateCandidateName(*log, candidate)
assert.Equal(t, "dev-a9d768213aaead8b42465ec859189de8779f96b7", candidateName, "device name generated incorrectly")

}

}
if assert.NoError(t, err) {
assert.Equal(t, 5, len(filteredDevices))
assert.Equal(t, 6, len(filteredDevices))
}
})

Expand Down Expand Up @@ -605,7 +610,33 @@ var (
"wwn": null,
"kname": "/dev/drbd1028",
"pkname": "/dev/dm-10"
}
},{
"name": "/dev/vdc",
"mountpoint": null,
"partuuid": null,
"hotplug": false,
"model": null,
"serial": "fhmnscgfsllbsi2u5o8v",
"size": "20G",
"fstype": null,
"type": "disk",
"wwn": null,
"kname": "/dev/vdc",
"pkname": null
},{
"name": "/dev/vdc1",
"mountpoint": null,
"partuuid": "13dcb00e-01",
"hotplug": false,
"model": null,
"serial": null,
"size": "20G",
"fstype": null,
"type": "part",
"wwn": null,
"kname": "/dev/vdc1",
"pkname": "/dev/vdc"
}
]
}`
)

0 comments on commit 1e67759

Please sign in to comment.