1
0
mirror of https://github.com/Oxalide/vsphere-influxdb-go.git synced 2023-10-10 13:36:51 +02:00
vsphere-influxdb-go/vendor/github.com/vmware/govmomi/govc/test/session.bats

37 lines
886 B
Plaintext
Raw Normal View History

2017-10-25 22:52:40 +02:00
#!/usr/bin/env bats
load test_helper
@test "session.ls" {
run govc session.ls
assert_success
run govc session.ls -json
assert_success
# Test User-Agent
govc session.ls | grep "$(govc version | tr ' ' /)"
}
@test "session.rm" {
run govc session.rm enoent
assert_failure
assert_output "govc: ServerFaultCode: The object or item referred to could not be found."
# Can't remove the current session
id=$(govc session.ls -json | jq -r .CurrentSession.Key)
run govc session.rm "$id"
assert_failure
thumbprint=$(govc about.cert -thumbprint)
# persist session just to avoid the Logout() so we can session.rm below
dir=$(mktemp -d govc-test-XXXXX)
id=$(GOVMOMI_HOME="$dir" govc session.ls -json -k=false -persist-session -tls-known-hosts <(echo "$thumbprint") | jq -r .CurrentSession.Key)
rm -rf "$dir"
run govc session.rm "$id"
assert_success
}