mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
33 lines
527 B
Go
33 lines
527 B
Go
package fileutils2
|
|
|
|
import "testing"
|
|
|
|
func TestIsBlockDeviceUsed(t *testing.T) {
|
|
type args struct {
|
|
dev string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
{
|
|
name: "nbd1",
|
|
args: args{"/dev/nbd1"},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "sda",
|
|
args: args{"/dev/sda"},
|
|
want: true,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := IsBlockDeviceUsed(tt.args.dev); got != tt.want {
|
|
t.Errorf("IsBlockDeviceUsed() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|