forked from vmware/govmomi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vcsa_shutdown.bats
executable file
·82 lines (56 loc) · 1.82 KB
/
vcsa_shutdown.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
80
81
82
#!/usr/bin/env bats
load test_helper
@test "vcsa.shutdown.poweroff" {
vcsim_env
local output
run govc vcsa.shutdown.poweroff -delay 50 "powering off for maintenance"
assert_success
status=$(govc vcsa.shutdown.get| grep -ow "poweroff"| awk '{print $1}')
assert_equal $status 'poweroff'
run govc vcsa.shutdown.poweroff -delay 50 "powering off for maintenance"
assert_success
status=$(govc vcsa.shutdown.get| grep -ow "poweroff"| awk '{print $1}')
assert_equal $status 'poweroff'
run govc vcsa.shutdown.poweroff
assert_failure
}
@test "vcsa.shutdown.reboot" {
vcsim_env
local output
run govc vcsa.shutdown.reboot -delay 50 "rebooting for maintenance"
assert_success
status=$(govc vcsa.shutdown.get| grep -ow "reboot"| awk '{print $1}')
assert_equal $status 'reboot'
run govc vcsa.shutdown.reboot -delay 50 "rebooting for maintenance"
assert_success
status=$(govc vcsa.shutdown.get| grep -ow "reboot"| awk '{print $1}')
assert_equal $status 'reboot'
run govc vcsa.shutdown.reboot
assert_failure
}
@test "vcsa.shutdown.get" {
vcsim_env
local output
run govc vcsa.shutdown.get
assert_success
run govc vcsa.shutdown.get -json
assert_success
run govc vcsa.shutdown.status -yaml
assert_failure
}
@test "vcsa.shutdown.cancel" {
vcsim_env
local output
run govc vcsa.shutdown.cancel
assert_success
run govc vcsa.shutdown.reboot -delay 50 "rebooting for maintenance"
assert_success
run govc vcsa.shutdown.cancel
status=$(govc vcsa.shutdown.get| grep -i "Action"| awk '{print $2}')
assert_equal $status ''
status=$(govc vcsa.shutdown.get| grep -i "ShutDownTime"| awk '{print $2}')
assert_equal $status ''
status=$(govc vcsa.shutdown.get| grep -i "Reason"| awk '{print $2}')
run govc vcsa.shutdown.cancel -reason "cancelling shutdown"
assert_failure
}