github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/acceptance/test_files/installation.bats (about) 1 load "$LIB_BATS_ASSERT/load.bash" 2 load "$LIB_BATS_SUPPORT/load.bash" 3 4 @test "check postgres database, fdw are correctly installed" { 5 # create a fresh target install dir 6 target_install_directory=$(mktemp -d) 7 8 # running steampipe - this would install the postgres database and the FDW from the registry 9 steampipe query "select 1" --install-dir $target_install_directory 10 11 # check postgres binary is present in correct location 12 run file $target_install_directory/db/14.2.0/postgres/bin/postgres 13 if [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then 14 assert_output --partial 'Mach-O 64-bit executable x86_64' 15 elif [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then 16 assert_output --partial 'Mach-O 64-bit executable arm64' 17 elif [[ "$arch" == "x86_64" && "$os" == "Linux" ]]; then 18 assert_output --partial 'ELF 64-bit LSB executable, x86-64' 19 elif [[ "$arch" == "aarch64" && "$os" == "Linux" ]]; then 20 assert_output --partial 'ELF 64-bit LSB executable, ARM aarch64' 21 fi 22 23 # check initdb binary is present in the correct location 24 run file $target_install_directory/db/14.2.0/postgres/bin/initdb 25 if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then 26 assert_output --partial 'Mach-O 64-bit executable arm64' 27 elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then 28 assert_output --partial 'Mach-O 64-bit executable x86_64' 29 elif [[ "$arch" == "x86_64" && "$os" == "Linux" ]]; then 30 assert_output --partial 'ELF 64-bit LSB executable, x86-64' 31 elif [[ "$arch" == "aarch64" && "$os" == "Linux" ]]; then 32 assert_output --partial 'ELF 64-bit LSB executable, ARM aarch64' 33 fi 34 35 # check fdw binary(steampipe_postgres_fdw.so) is present in the correct location 36 run file $target_install_directory/db/14.2.0/postgres/lib/postgresql/steampipe_postgres_fdw.so 37 if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then 38 assert_output --partial 'Mach-O 64-bit bundle arm64' 39 elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then 40 assert_output --partial 'Mach-O 64-bit bundle x86_64' 41 elif [[ "$arch" == "x86_64" && "$os" == "Linux" ]]; then 42 assert_output --partial 'ELF 64-bit LSB shared object, x86-64' 43 elif [[ "$arch" == "aarch64" && "$os" == "Linux" ]]; then 44 assert_output --partial 'ELF 64-bit LSB shared object, ARM aarch64' 45 fi 46 47 # check fdw extension(steampipe_postgres_fdw.control) is present in the correct location 48 run file $target_install_directory/db/14.2.0/postgres/share/postgresql/extension/steampipe_postgres_fdw.control 49 assert_output --partial 'ASCII text' 50 } 51 52 @test "check plugin is correctly installed" { 53 # create a fresh target install dir 54 target_install_directory=$(mktemp -d) 55 56 # running steampipe - this would install the postgres database and the FDW from the registry 57 steampipe query "select 1" --install-dir $target_install_directory 58 59 # install a plugin 60 steampipe plugin install chaos --install-dir $target_install_directory --progress=false 61 62 # check plugin binary is present in correct location 63 run file $target_install_directory/plugins/hub.steampipe.io/plugins/turbot/chaos@latest/steampipe-plugin-chaos.plugin 64 if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then 65 assert_output --partial 'Mach-O 64-bit executable arm64' 66 elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then 67 assert_output --partial 'Mach-O 64-bit executable x86_64' 68 elif [[ "$arch" == "x86_64" && "$os" == "Linux" ]]; then 69 assert_output --partial 'ELF 64-bit LSB executable, x86-64' 70 elif [[ "$arch" == "aarch64" && "$os" == "Linux" ]]; then 71 assert_output --partial 'ELF 64-bit LSB executable, ARM aarch64' 72 fi 73 74 # check spc config file is present in correct location 75 run file $target_install_directory/config/chaos.spc 76 assert_output --partial 'ASCII text' 77 } 78 79 function setup() { 80 arch=$(uname -m) 81 os=$(uname -s) 82 } 83 84 function teardown_file() { 85 # list running processes 86 ps -ef | grep steampipe 87 88 # check if any processes are running 89 num=$(ps aux | grep steampipe | grep -v bats | grep -v grep | grep -v tests/acceptance | wc -l | tr -d ' ') 90 assert_equal $num 0 91 }