forked from vmware/govmomi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.bats
executable file
·75 lines (52 loc) · 1.36 KB
/
tasks.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
#!/usr/bin/env bats
load test_helper
@test "tasks" {
vcsim_env
run govc tasks
assert_success
run govc tasks vm/DC0_H0_VM0
assert_success
assert_matches PowerOn
run govc tasks vm/DC0_H0_VM0 vm/DC0_H0_VM1
assert_failure # > 1 arg
run govc tasks 'host/*'
assert_failure # matches 2 objects
run govc tasks -b 1h
assert_success
[ ${#lines[@]} -gt 10 ]
run govc tasks -r /DC0/vm
assert_success
assert_matches CreateVm
assert_matches PowerOn
}
@test "tasks esx" {
vcsim_env -esx
run govc tasks
assert_success
run govc tasks -b 1h
assert_failure # TaskHistoryCollector not supported on ESX
run govc tasks -r
assert_failure # TaskHistoryCollector not supported on ESX
}
@test "task.create" {
vcsim_env
export GOVC_SHOW_UNRELEASED=true
run govc task.create enoent
assert_failure
id=$(govc extension.info -json | jq -r '.extensions[].taskList | select(. != null) | .[].taskID' | head -1)
assert_equal com.vmware.govmomi.simulator.test "$id"
run govc task.create "$id"
assert_success
task="$output"
run govc task.set -s running "$task"
assert_success
govc tasks | grep "$id"
run govc task.set -d "$id.init" -m "task init" "$task"
assert_success
run govc task.set -p 42 "$task"
assert_success
run govc task.set -s success "$task"
assert_success
run govc task.set -s running "$task"
assert_failure
}