mirror of
https://github.com/Oxalide/vsphere-influxdb-go.git
synced 2023-10-10 13:36:51 +02:00
86 lines
1.6 KiB
Plaintext
86 lines
1.6 KiB
Plaintext
|
#!/usr/bin/env bats
|
||
|
|
||
|
load test_helper
|
||
|
|
||
|
@test "metric.ls" {
|
||
|
run govc metric.ls
|
||
|
assert_failure
|
||
|
|
||
|
run govc metric.ls enoent
|
||
|
assert_failure
|
||
|
|
||
|
host=$(govc ls -t HostSystem ./... | head -n 1)
|
||
|
pool=$(govc ls -t ResourcePool ./... | head -n 1)
|
||
|
|
||
|
run govc metric.ls "$host"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.ls -json "$host"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.ls "$pool"
|
||
|
assert_success
|
||
|
}
|
||
|
|
||
|
@test "metric.sample" {
|
||
|
host=$(govc ls -t HostSystem ./... | head -n 1)
|
||
|
metrics=($(govc metric.ls "$host"))
|
||
|
|
||
|
run govc metric.sample "$host" enoent
|
||
|
assert_failure
|
||
|
|
||
|
run govc metric.sample "$host" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.sample -instance - "$host" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.sample -json "$host" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
vm=$(new_ttylinux_vm)
|
||
|
|
||
|
run govc metric.ls "$vm"
|
||
|
assert_output ""
|
||
|
|
||
|
run govc vm.power -on "$vm"
|
||
|
assert_success
|
||
|
|
||
|
run govc vm.ip "$vm"
|
||
|
assert_success
|
||
|
|
||
|
metrics=($(govc metric.ls "$vm"))
|
||
|
|
||
|
run govc metric.sample "$vm" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.sample -json "$vm" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.sample "govc-test-*" "${metrics[@]}"
|
||
|
assert_success
|
||
|
}
|
||
|
|
||
|
@test "metric.info" {
|
||
|
host=$(govc ls -t HostSystem ./... | head -n 1)
|
||
|
metrics=($(govc metric.ls "$host"))
|
||
|
|
||
|
run govc metric.info "$host" enoent
|
||
|
assert_failure
|
||
|
|
||
|
run govc metric.info "$host"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.info -json "$host"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.sample "$host" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.info "$host" "${metrics[@]}"
|
||
|
assert_success
|
||
|
|
||
|
run govc metric.info - "${metrics[@]}"
|
||
|
assert_success
|
||
|
}
|