github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/acceptance/test_files/search_path.bats (about) 1 load "$LIB_BATS_ASSERT/load.bash" 2 load "$LIB_BATS_SUPPORT/load.bash" 3 load "$LIB/connection_map_utils.bash" 4 5 @test "add connection, check search path updated" { 6 cp $SRC_DATA_DIR/single_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 7 8 # Wait for all connection states to be 'ready' 9 run wait_connection_map_stable 10 [ "$status" -eq 0 ] 11 12 run steampipe query "show search_path" 13 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_1.txt)" 14 cp $SRC_DATA_DIR/two_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 15 16 # Wait for all connection states to be 'ready' 17 run wait_connection_map_stable 18 [ "$status" -eq 0 ] 19 20 run steampipe query "show search_path" 21 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_2.txt)" 22 } 23 24 @test "delete connection, check search path updated" { 25 26 # Wait for all connection states to be 'ready' 27 run wait_connection_map_stable 28 [ "$status" -eq 0 ] 29 30 run steampipe query "show search_path" 31 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_2.txt)" 32 cp $SRC_DATA_DIR/single_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 33 34 # Wait for all connection states to be 'ready' 35 run wait_connection_map_stable 36 [ "$status" -eq 0 ] 37 38 run steampipe query "show search_path" 39 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_1.txt)" 40 } 41 42 @test "add connection, query with prefix" { 43 44 # Wait for all connection states to be 'ready' 45 run wait_connection_map_stable 46 [ "$status" -eq 0 ] 47 48 run steampipe query "show search_path" 49 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_1.txt)" 50 cp $SRC_DATA_DIR/two_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 51 52 # Wait for all connection states to be 'ready' 53 run wait_connection_map_stable 54 [ "$status" -eq 0 ] 55 56 run steampipe query "show search_path" --search-path-prefix foo 57 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_3.txt)" 58 } 59 60 @test "delete connection, query with prefix" { 61 62 # Wait for all connection states to be 'ready' 63 run wait_connection_map_stable 64 [ "$status" -eq 0 ] 65 66 run steampipe query "show search_path" 67 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_2.txt)" 68 cp $SRC_DATA_DIR/single_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 69 70 # Wait for all connection states to be 'ready' 71 run wait_connection_map_stable 72 [ "$status" -eq 0 ] 73 74 run steampipe query "show search_path" --search-path-prefix foo 75 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_4.txt)" 76 } 77 78 @test "query with prefix, add connection, query with prefix" { 79 80 # Wait for all connection states to be 'ready' 81 run wait_connection_map_stable 82 [ "$status" -eq 0 ] 83 84 run steampipe query "show search_path" --search-path-prefix foo 85 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_5.txt)" 86 cp $SRC_DATA_DIR/two_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 87 88 # Wait for all connection states to be 'ready' 89 run wait_connection_map_stable 90 [ "$status" -eq 0 ] 91 92 run steampipe query "show search_path" --search-path-prefix foo2 93 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_6.txt)" 94 } 95 96 @test "query with prefix, delete connection, query with prefix" { 97 98 # Wait for all connection states to be 'ready' 99 run wait_connection_map_stable 100 [ "$status" -eq 0 ] 101 102 run steampipe query "show search_path" --search-path-prefix foo2 103 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_6.txt)" 104 cp $SRC_DATA_DIR/single_chaos.spc $STEAMPIPE_INSTALL_DIR/config/chaos.spc 105 106 # Wait for all connection states to be 'ready' 107 run wait_connection_map_stable 108 [ "$status" -eq 0 ] 109 110 run steampipe query "show search_path" --search-path-prefix foo 111 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_5.txt)" 112 } 113 114 @test "verify that 'internal' schema is added" { 115 116 # Wait for all connection states to be 'ready' 117 run wait_connection_map_stable 118 [ "$status" -eq 0 ] 119 120 run steampipe query "show search_path" --search-path foo 121 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_internal_schema_once_1.txt)" 122 } 123 124 @test "verify that 'internal' schema is always suffixed if passed in as custom" { 125 126 # Wait for all connection states to be 'ready' 127 run wait_connection_map_stable 128 [ "$status" -eq 0 ] 129 130 run steampipe query "show search_path" --search-path foo1,steampipe_internal,foo2 131 assert_output "$(cat $TEST_DATA_DIR/expected_search_path_internal_schema_once_2.txt)" 132 } 133 134 function teardown_file() { 135 # list running processes 136 ps -ef | grep steampipe 137 138 # check if any processes are running 139 num=$(ps aux | grep steampipe | grep -v bats | grep -v grep | grep -v tests/acceptance | wc -l | tr -d ' ') 140 assert_equal $num 0 141 }