github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/acceptance/test_files/exit_codes.bats (about) 1 load "$LIB_BATS_ASSERT/load.bash" 2 load "$LIB_BATS_SUPPORT/load.bash" 3 4 @test "steampipe query fail with non-0 exit code" { 5 # this query should fail with a non 0 exit code 6 run steampipe query "select * from abc" 7 echo $status 8 [ $status -ne 0 ] 9 } 10 11 @test "steampipe check fail with non-0 exit code" { 12 cd $WORKSPACE_DIR 13 # this check should fail with a non 0 exit code, due to insufficient args 14 run steampipe check 15 echo $status 16 [ $status -ne 0 ] 17 } 18 19 @test "steampipe query pass with 0 exit code" { 20 # this query should pass and return a 0 exit code 21 run steampipe query "select 1" 22 echo $status 23 [ $status -eq 0 ] 24 } 25 26 function teardown_file() { 27 # list running processes 28 ps -ef | grep steampipe 29 30 # check if any processes are running 31 num=$(ps aux | grep steampipe | grep -v bats | grep -v grep | grep -v tests/acceptance | wc -l | tr -d ' ') 32 assert_equal $num 0 33 }