I am using BATS testing framework with bats-assert and bats-support.
I want to ensure that the user remembered to set the ELASTIC_CREDS env variable properly. How do I do that? Here is what I've tried:
config.bash
export SYSTEM_CREDS=myuser:mypass
Then, my checkcreds.bats test fike looks like this:
checkcreds.bats
#! ./libs/bats/bin/bats
load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'config'
@test 'assert_system_creds()' {
run env | grep SYSTEM_CREDS | awk -F= '{print$2}'
assert_output --regexp '^.*:.*$'
}