5
@test "create and destroy datacenters" {
7
dcs=(`uuidgen` `uuidgen`)
8
run govc datacenter.create ${dcs[0]} ${dcs[1]}
11
for dc in ${dcs[*]}; do
14
# /<datacenter>/{vm,network,host,datastore}
15
[ ${#lines[@]} -eq 4 ]
18
run govc datacenter.destroy ${dcs[0]} ${dcs[1]}
21
for dc in ${dcs[*]}; do
24
[ ${#lines[@]} -eq 0 ]
28
@test "destroy datacenter using glob" {
31
dcs=(${prefix}-`uuidgen` ${prefix}-`uuidgen`)
32
run govc datacenter.create ${dcs[0]} ${dcs[1]}
35
run govc datacenter.destroy ${prefix}-*
38
for dc in ${dcs[*]}; do
41
[ ${#lines[@]} -eq 0 ]
45
@test "destroy datacenter that doesn't exist" {
49
run govc datacenter.destroy $dc
53
@test "create datacenter that already exists" {
57
run govc datacenter.create $dc
60
run govc datacenter.create $dc
63
run govc datacenter.destroy $dc
67
@test "fails when datacenter name not specified" {
68
run govc datacenter.create
71
run govc datacenter.destroy
75
@test "fails when operation attempted on standalone ESX host" {
76
run govc datacenter.create something
78
assert_output "Error: ServerFaultCode: The operation is not supported on the object."
81
@test "fails when attempting to destroy ha-datacenter" {
82
run govc datacenter.destroy ha-datacenter
84
assert_output "Error: The operation is not supported on the object."