MCPcopy
hub / github.com/google/cadvisor / TestGetBlockDeviceInfo

Function TestGetBlockDeviceInfo

lib/utils/sysinfo/sysinfo_test.go:1337–1361  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1335}
1336
1337func TestGetBlockDeviceInfo(t *testing.T) {
1338 fakeSys := fakesysfs.FakeSysFs{}
1339 disks, err := GetBlockDeviceInfo(&fakeSys)
1340 if err != nil {
1341 t.Errorf("expected call to GetBlockDeviceInfo() to succeed. Failed with %s", err)
1342 }
1343 if len(disks) != 1 {
1344 t.Errorf("expected to get one disk entry. Got %d", len(disks))
1345 }
1346 key := "8:0"
1347 disk, ok := disks[key]
1348 if !ok {
1349 t.Fatalf("expected key 8:0 to exist in the disk map.")
1350 }
1351 if disk.Name != "sda" {
1352 t.Errorf("expected to get disk named sda. Got %q", disk.Name)
1353 }
1354 size := uint64(1234567 * 512)
1355 if disk.Size != size {
1356 t.Errorf("expected to get disk size of %d. Got %d", size, disk.Size)
1357 }
1358 if disk.Scheduler != "cfq" {
1359 t.Errorf("expected to get scheduler type of cfq. Got %q", disk.Scheduler)
1360 }
1361}
1362
1363func TestGetNetworkDevices(t *testing.T) {
1364 fakeSys := fakesysfs.FakeSysFs{}

Callers

nothing calls this directly

Calls 2

GetBlockDeviceInfoFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…