21 lines
554 B
Go
21 lines
554 B
Go
package validators
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"jagacloud/node-agent/pkg/compute/libvirt"
|
|
"jagacloud/node-agent/pkg/config"
|
|
)
|
|
|
|
func TestPoolExists(t *testing.T) {
|
|
cfg := config.Config{StoragePools: []config.StoragePool{{Name: "local"}}}
|
|
err := CheckStoragePoolsVM([]libvirt.DiskSpec{{Pool: "local"}}, cfg)
|
|
if err != nil {
|
|
t.Fatalf("expected pool to be valid: %v", err)
|
|
}
|
|
err = CheckStoragePoolsVM([]libvirt.DiskSpec{{Pool: "missing"}}, cfg)
|
|
if err == nil {
|
|
t.Fatalf("expected error for missing pool")
|
|
}
|
|
}
|