tests: add CLI tests for version output (#664)

build-e08ab98a2b128ee202eae46551da23c831b4acfc-13facd1eb832bef v0.1.0
Jeff Malnick 6 years ago committed by GitHub
parent 342026b83a
commit e08ab98a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save