mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-31 02:38:07 +08:00
55 lines
891 B
Go
55 lines
891 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)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestGetDevId(t *testing.T) {
|
|
type args struct {
|
|
spath string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want string
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := GetDevId(tt.args.spath); got != tt.want {
|
|
t.Errorf("GetDevId() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|