fix tests

This commit is contained in:
Puskar Basu
2025-03-06 18:25:11 +05:30
parent 59e654c6a8
commit f695c8bef6
2 changed files with 15 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
steampipe query "select 1" --install-dir $target_install_directory
# check postgres binary is present in correct location
run file $target_install_directory/db/14.2.0/postgres/bin/postgres
run file $target_install_directory/db/14.17.0/postgres/bin/postgres
if [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then
assert_output --partial 'Mach-O 64-bit executable x86_64'
elif [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then
@@ -21,7 +21,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
fi
# check initdb binary is present in the correct location
run file $target_install_directory/db/14.2.0/postgres/bin/initdb
run file $target_install_directory/db/14.17.0/postgres/bin/initdb
if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then
assert_output --partial 'Mach-O 64-bit executable arm64'
elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then
@@ -33,7 +33,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
fi
# check fdw binary(steampipe_postgres_fdw.so) is present in the correct location
run file $target_install_directory/db/14.2.0/postgres/lib/postgresql/steampipe_postgres_fdw.so
run file $target_install_directory/db/14.17.0/postgres/lib/postgresql/steampipe_postgres_fdw.so
if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then
assert_output --partial 'Mach-O 64-bit bundle arm64'
elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then
@@ -45,7 +45,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
fi
# check fdw extension(steampipe_postgres_fdw.control) is present in the correct location
run file $target_install_directory/db/14.2.0/postgres/share/postgresql/extension/steampipe_postgres_fdw.control
run file $target_install_directory/db/14.17.0/postgres/share/postgresql/extension/steampipe_postgres_fdw.control
assert_output --partial 'ASCII text'
}

View File

@@ -5,7 +5,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
current_year=$(date +"%Y")
steampipe service start
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/root.crt
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
echo $output
# check enddate
assert_output --partial "notAfter=Dec 31 23:59:59 9999 GMT"
@@ -13,7 +13,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
server_expiry=$((current_year + 3))
echo $server_expiry
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.crt
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
echo $output
# check enddate
assert_output --partial "$server_expiry"
@@ -23,25 +23,25 @@ load "$LIB_BATS_SUPPORT/load.bash"
steampipe service start
# save file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/root.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
id_root=$(echo $output | awk '{print $1}')
echo $id_root
# save file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
id_server=$(echo $output | awk '{print $1}')
echo $id_server
steampipe service restart
# check file hash after restart
run cksum $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/root.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
id_root_new=$(echo $output | awk '{print $1}')
echo $id_root_new
assert_equal $id_root $id_root_new
# check file hash after restart
run cksum $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
id_server_new=$(echo $output | awk '{print $1}')
echo $id_server_new
@@ -52,17 +52,17 @@ load "$LIB_BATS_SUPPORT/load.bash"
@test "deleting root certificate, service start should regenerate server and root certs" {
# save file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
id_server=$(echo $output | awk '{print $1}')
echo $id_server
# delete root certificate
rm -f $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/root.crt
rm -f $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
steampipe service start
# save new file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
id_server_new=$(echo $output | awk '{print $1}')
echo $id_server_new
@@ -77,9 +77,9 @@ load "$LIB_BATS_SUPPORT/load.bash"
}
@test "adding an encrypted private key should work fine and service should start successfully" {
run openssl genrsa -aes256 -out $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.key -passout pass:steampipe -traditional 2048
run openssl genrsa -aes256 -out $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.key -passout pass:steampipe -traditional 2048
run openssl req -key $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.key -passin pass:steampipe -new -x509 -out $STEAMPIPE_INSTALL_DIR/db/14.2.0/data/server.crt -subj "/CN=steampipe.io"
run openssl req -key $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.key -passin pass:steampipe -new -x509 -out $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt -subj "/CN=steampipe.io"
steampipe service start --database-ssl-password steampipe
}