github.com/vmware/govmomi@v0.43.0/govc/test/vcsa_shutdown.bats (about) 1 #!/usr/bin/env bats 2 3 load test_helper 4 5 @test "vcsa.shutdown.poweroff" { 6 vcsim_env 7 local output 8 9 run govc vcsa.shutdown.poweroff -delay 50 "powering off for maintenance" 10 assert_success 11 12 status=$(govc vcsa.shutdown.get| grep -ow "poweroff"| awk '{print $1}') 13 assert_equal $status 'poweroff' 14 15 run govc vcsa.shutdown.poweroff -delay 50 "powering off for maintenance" 16 assert_success 17 18 status=$(govc vcsa.shutdown.get| grep -ow "poweroff"| awk '{print $1}') 19 assert_equal $status 'poweroff' 20 21 run govc vcsa.shutdown.poweroff 22 assert_failure 23 24 } 25 26 @test "vcsa.shutdown.reboot" { 27 vcsim_env 28 local output 29 30 run govc vcsa.shutdown.reboot -delay 50 "rebooting for maintenance" 31 assert_success 32 33 status=$(govc vcsa.shutdown.get| grep -ow "reboot"| awk '{print $1}') 34 assert_equal $status 'reboot' 35 36 run govc vcsa.shutdown.reboot -delay 50 "rebooting for maintenance" 37 assert_success 38 39 status=$(govc vcsa.shutdown.get| grep -ow "reboot"| awk '{print $1}') 40 assert_equal $status 'reboot' 41 42 run govc vcsa.shutdown.reboot 43 assert_failure 44 45 } 46 47 48 @test "vcsa.shutdown.get" { 49 vcsim_env 50 local output 51 52 run govc vcsa.shutdown.get 53 assert_success 54 55 run govc vcsa.shutdown.get -json 56 assert_success 57 58 run govc vcsa.shutdown.status -yaml 59 assert_failure 60 } 61 62 63 @test "vcsa.shutdown.cancel" { 64 vcsim_env 65 local output 66 67 run govc vcsa.shutdown.cancel 68 assert_success 69 70 run govc vcsa.shutdown.reboot -delay 50 "rebooting for maintenance" 71 assert_success 72 run govc vcsa.shutdown.cancel 73 status=$(govc vcsa.shutdown.get| grep -i "Action"| awk '{print $2}') 74 assert_equal $status '' 75 status=$(govc vcsa.shutdown.get| grep -i "ShutDownTime"| awk '{print $2}') 76 assert_equal $status '' 77 status=$(govc vcsa.shutdown.get| grep -i "Reason"| awk '{print $2}') 78 79 80 run govc vcsa.shutdown.cancel -reason "cancelling shutdown" 81 assert_failure 82 }