Revision 9f22ba9a
b/qa/rapi-workload.py | ||
---|---|---|
156 | 156 |
return None |
157 | 157 |
|
158 | 158 |
|
159 |
def TestTags(client, get_fn, add_fn, delete_fn, *args): |
|
160 |
""" Tests whether tagging works. |
|
161 |
|
|
162 |
@type client C{GanetiRapiClientWrapper} |
|
163 |
@param client The client wrapper. |
|
164 |
@type get_fn function |
|
165 |
@param get_fn A Get*Tags function of the client. |
|
166 |
@type add_fn function |
|
167 |
@param add_fn An Add*Tags function of the client. |
|
168 |
@type delete_fn function |
|
169 |
@param delete_fn A Delete*Tags function of the client. |
|
170 |
|
|
171 |
To allow this method to work for all tagging functions of the client, use |
|
172 |
named methods. |
|
173 |
|
|
174 |
""" |
|
175 |
get_fn(*args) |
|
176 |
|
|
177 |
tags = ["tag1", "tag2", "tag3"] |
|
178 |
Finish(client, add_fn, *args, tags=tags, dry_run=True) |
|
179 |
Finish(client, add_fn, *args, tags=tags) |
|
180 |
|
|
181 |
get_fn(*args) |
|
182 |
|
|
183 |
Finish(client, delete_fn, *args, tags=tags[:1], dry_run=True) |
|
184 |
Finish(client, delete_fn, *args, tags=tags[:1]) |
|
185 |
|
|
186 |
get_fn(*args) |
|
187 |
|
|
188 |
Finish(client, delete_fn, *args, tags=tags[1:]) |
|
189 |
|
|
190 |
get_fn(*args) |
|
191 |
|
|
192 |
|
|
159 | 193 |
def Workload(client): |
160 | 194 |
""" The actual RAPI workload used for tests. |
161 | 195 |
|
... | ... | |
183 | 217 |
|
184 | 218 |
Finish(client, client.RedistributeConfig) |
185 | 219 |
|
220 |
TestTags(client, client.GetClusterTags, client.AddClusterTags, |
|
221 |
client.DeleteClusterTags) |
|
222 |
|
|
223 |
# Generously assume the master is present |
|
224 |
node = qa_config.AcquireNode() |
|
225 |
TestTags(client, client.GetNodeTags, client.AddNodeTags, |
|
226 |
client.DeleteNodeTags, node.primary) |
|
227 |
node.Release() |
|
228 |
|
|
186 | 229 |
|
187 | 230 |
def Usage(): |
188 | 231 |
sys.stderr.write("Usage:\n\trapi-workload.py qa-config-file") |
Also available in: Unified diff