-
Notifications
You must be signed in to change notification settings - Fork 951
Expand file tree
/
Copy pathvlcm.bats
More file actions
executable file
·191 lines (136 loc) · 5.04 KB
/
vlcm.bats
File metadata and controls
executable file
·191 lines (136 loc) · 5.04 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/usr/bin/env bats
load test_helper
location="http://127.0.0.1:9999/files/custom_driver.zip"
@test "vlcm.depot.offline.ls" {
vcsim_env
run govc vlcm.depot.offline.ls
assert_success
}
@test "vlcm.depot.offline.create" {
vcsim_env
run govc vlcm.depot.offline.create -l=$location -source-type=PULL
assert_success
depot=$(govc vlcm.depot.offline.ls | jq '."depot-1"')
l=$(echo $depot | jq -r '.location')
assert_equal $location $l
srcType=$(echo $depot | jq -r '."source_type"')
assert_equal "PULL" $srcType
}
@test "vlcm.depot.offline.info" {
vcsim_env
run govc vlcm.depot.offline.create -l=$location -source-type=PULL
assert_success ""
depot=$(govc vlcm.depot.offline.info -depot-id=depot-1)
comp=$(echo $depot | jq '."metadata_bundles"."dummy-content"[0]."independent_components"."dummy-component"')
name=$(echo $comp | jq -r '."display_name"')
assert_equal "DummyComponent" $name
version=$(echo $comp | jq -r '.versions[0].version')
displayVersion=$(echo $comp | jq -r '.versions[0]."display_version"')
assert_equal "1.0.0" $version
assert_equal "1.0.0" $displayVersion
}
@test "vlcm.depot.offline.rm" {
vcsim_env
run govc vlcm.depot.offline.create -l=$location -source-type=PULL
assert_success
run govc vlcm.depot.offline.rm -depot-id=depot-1
assert_success
run govc vlcm.depot.offline.info -depot-id=depot-1
assert_failure
assert_matches "404 Not Found"
}
@test "cluster.draft.ls" {
vcsim_env
run govc cluster.draft.ls -cluster-id=domain-c21
assert_success
}
@test "cluster.draft.create" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
draft=$(govc cluster.draft.ls -cluster-id=domain-c21 | jq '."1"')
assert_equal "" $(echo $draft | jq -r '.owner')
}
@test "cluster.draft.info" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.info -cluster-id=domain-c21 -draft-id=1
assert_success
}
@test "cluster.draft.rm" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.rm -cluster-id=domain-c21 -draft-id=1
run govc cluster.draft.info -cluster-id=domain-c21 -draft-id=1
assert_failure
assert_matches "404 Not Found"
}
@test "cluster.draft.commit" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.commit -cluster-id=domain-c21 -draft-id=1
run govc cluster.draft.info -cluster-id=domain-c21 -draft-id=1
assert_failure
assert_matches "404 Not Found"
}
@test "cluster.draft.component.ls" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.component.ls -cluster-id=domain-c21 -draft-id=1
assert_success
}
@test "cluster.draft.component.add" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.component.add -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id -component-version=1.2.3.4
assert_success
comp=$(govc cluster.draft.component.ls -cluster-id=domain-c21 -draft-id=1 | jq '."comp-id"')
assert_equal "1.2.3.4" $(echo $comp | jq -r '.version')
assert_equal "DummyComponent" $(echo $comp | jq -r '.details.display_name')
}
@test "cluster.draft.component.info" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.component.add -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id -component-version=1.2.3.4
assert_success
comp=$(govc cluster.draft.component.info -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id)
assert_equal "1.2.3.4" $(echo $comp | jq -r '.version')
assert_equal "DummyComponent" $(echo $comp | jq -r '.details.display_name')
run govc cluster.draft.component.info -cluster-id=domain-c21 -draft-id=1 -component-id=invalid-id
assert_failure
assert_matches "404 Not Found"
}
@test "cluster.draft.component.rm" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.component.add -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id -component-version=1.2.3.4
assert_success
run govc cluster.draft.component.rm -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id
run govc cluster.draft.component.info -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id
assert_failure
assert_matches "404 Not Found"
}
@test "cluster.draft.baseimage.set" {
vcsim_env
run govc cluster.draft.create -cluster-id=domain-c21
assert_success
run govc cluster.draft.baseimage.set -cluster-id=domain-c21 -draft-id=1 -version=1.0.0
assert_success
baseimg=$(govc cluster.draft.baseimage.info -cluster-id=domain-c21 -draft-id=1)
assert_equal "1.0.0" $(echo $baseimg | jq -r '.version')
}
@test "cluster.vlcm.enable" {
vcsim_env
res=$(govc cluster.vlcm.info -cluster-id=domain-c21)
assert_equal "false" $(echo $res | jq -r '.enabled')
run govc cluster.vlcm.enable -cluster-id=domain-c21
res=$(govc cluster.vlcm.info -cluster-id=domain-c21)
assert_equal "true" $(echo $res | jq -r '.enabled')
}