forked from vmware/govmomi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
folder.bats
executable file
·79 lines (55 loc) · 1.39 KB
/
folder.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bats
load test_helper
@test "folder.info" {
vcsim_env -esx
for name in / vm host network datastore ; do
run govc folder.info $name
assert_success
govc folder.info -json $name
assert_success
done
result=$(govc folder.info '*' | grep -c Name:)
[ "$result" -eq 4 ]
run govc info.info /enoent
assert_failure
}
@test "folder.create" {
vcsim_env
name=$(new_id)
# relative to $GOVC_DATACENTER
run govc folder.create $name
assert_failure
run govc folder.create vm/$name
assert_success
run govc folder.info vm/$name
assert_success
run govc folder.info /$GOVC_DATACENTER/vm/$name
assert_success
run govc folder.create vm/$name
assert_failure # duplicate name
run govc object.destroy vm/$name
assert_success
unset GOVC_DATACENTER
# relative to /
run govc folder.create /$name
assert_success
run govc folder.info /$name
assert_success
child=$(new_id)
run govc folder.create /$child
assert_success
run govc folder.info /$name/$child
assert_failure
run govc object.mv /$child /$name
assert_success
run govc folder.info /$name/$child
assert_success
new=$(new_id)
run govc object.rename /$name $new
assert_success
name=$new
run govc folder.info /$name
assert_success
run govc object.destroy /$name
assert_success
}