adds some code

This commit is contained in:
2025-11-23 13:37:10 +07:00
parent 66591c1b71
commit b506a64ed1
6 changed files with 127 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
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")
}
}