From 1bf942a2c243f5108fe771752c14e33e9fb7ca2d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 01:39:14 +0300 Subject: [PATCH] check folder in default test --- builder_acc_test.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 691463de9..6e53f5cf0 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -42,7 +42,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "name", "runtime.host", "resourcePool", "layoutEx.disk") + vmInfo, err := d.VMInfo(vm, "name", "parent", "runtime.host", "resourcePool", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -51,6 +51,15 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) } + f := d.NewFolder(vmInfo.Parent) + folderPath, err := d.GetFolderPath(f) + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + h := d.NewHost(vmInfo.Runtime.Host) hostInfo, err := d.HostInfo(h, "name") if err != nil { @@ -62,13 +71,12 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc } p := d.NewResourcePool(vmInfo.ResourcePool) - poolInfo, err := d.ResourcePoolInfo(p, "owner", "parent") + poolPath, err := d.GetResourcePoolPath(p) if err != nil { - t.Fatalf("Cannot read resource pool properties: %v", err) + t.Fatalf("Cannot read resource pool name: %v", err) } - - if poolInfo.Owner != *poolInfo.Parent { - t.Error("Not a root resource pool") + if poolPath != "" { + t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) } if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 {