mirror of https://github.com/hashicorp/boundary
tests: add CLI tests for version output (#664)
parent
342026b83a
commit
e08ab98a2b
@ -0,0 +1,19 @@
|
||||
function version() {
|
||||
boundary version -format json
|
||||
}
|
||||
|
||||
function version_is_valid() {
|
||||
ver=$($(strip version) | jq -c '.version' | cut -d 'v' -f2)
|
||||
if [ "$ver" == "null" ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function revision_is_valid() {
|
||||
len=$($(strip version) | jq -c '.revision' | cut -d '+' -f1 | wc -m)
|
||||
if [ "$len" -eq 42 ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load _helpers
|
||||
load _version
|
||||
|
||||
export NEW_USER='test'
|
||||
|
||||
@test "boundary/version: can run version command" {
|
||||
run version
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/version: version output is valid" {
|
||||
run version_is_valid
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/version: revision output is valid" {
|
||||
run revision_is_valid
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
Loading…
Reference in new issue