github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/acceptance/test_files/performance.bats (about) 1 load "$LIB_BATS_ASSERT/load.bash" 2 load "$LIB_BATS_SUPPORT/load.bash" 3 4 @test "time to query a chaos table" { 5 6 # # using bash's built-in time, set the timeformat to seconds 7 # TIMEFORMAT=%R 8 9 # # find the query time 10 # QUERY_TIME=$(time (run steampipe query "select time_col from chaos.chaos_cache_check where id=0" >/dev/null 2>&1) 2>&1) 11 # echo $QUERY_TIME 12 # echo $TIME_TO_QUERY 13 14 # # Check whether time to query is less than 4 seconds(This value can be changed) 15 # # The query should get completed within 2secs, however we check whether it is less 16 # # than 4 in order to avoid failures in our github workflows. 17 # assert_equal "$(echo $QUERY_TIME '<' $TIME_TO_QUERY | bc -l)" "1" 18 } 19 20 @test "time to query a chaos table that does not exist" { 21 22 # # using bash's built-in time, set the timeformat to seconds 23 # TIMEFORMAT=%R 24 25 # # find the time it takes to throw the error 26 # QUERY_TIME=$(time (run steampipe query "select time_col from chaos.chaos_cache_check_2 where id=0" >/dev/null 2>&1) 2>&1) 27 # echo $QUERY_TIME 28 # echo $TIME_TO_QUERY 29 30 # # Check whether time to error out is less than 4 seconds(This value can be changed). 31 # # The query should get completed within 2secs, however we check whether it is less 32 # # than 4 in order to avoid failures in our github workflows. 33 # assert_equal "$(echo $QUERY_TIME '<' $TIME_TO_QUERY | bc -l)" "1" 34 }