mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-29 16:15:41 +02:00
TestGetDevices
This commit is contained in:
@@ -3,12 +3,29 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetDevices(t *testing.T) {
|
func TestGetDevices(t *testing.T) {
|
||||||
result := GetDevices()
|
result := GetDevices()
|
||||||
|
|
||||||
fmt.Println(result)
|
if len(result) == 0 {
|
||||||
|
t.Log("Expecting at least 1 block device, 0 elements found in slice")
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
|
||||||
|
foundDevice := false
|
||||||
|
|
||||||
|
t.Log("Looking for a mmcblk0 or sda device")
|
||||||
|
for _, device := range result {
|
||||||
|
if device.ID == "mmcblk0" || device.ID == "sda" {
|
||||||
|
t.Log("Found target device", device.ID)
|
||||||
|
foundDevice = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !foundDevice {
|
||||||
|
t.Log("Expected to find device mmcblk0 but did not. Devices:", result)
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user