Skip to content

Commit

Permalink
Smoketests work on macos (#15)
Browse files Browse the repository at this point in the history
* Some work

* Getting smoketests working on mac

* All tests are passing except known failing tests

---------

Co-authored-by: Boppy <no-reply@boppygames.gg>
  • Loading branch information
2 people authored and cloutiertyler committed Aug 1, 2023
1 parent 18121fb commit cd8ddd2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
10 changes: 10 additions & 0 deletions test/lib.include
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ spacetime_publish() {
set -e
return "$RESULT_CODE"
}

fsed() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i.sed_bak "$@"
rm -f rm *.sed_bak
else
sed -i "$@"
fi
}

10 changes: 5 additions & 5 deletions test/tests/autoinc1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source "./test/lib.include"
do_test() {
echo "RUNNING TEST FOR VALUE: $1"
create_project

cat > "${PROJECT_PATH}/src/lib.rs" << EOF
use spacetimedb::{println, spacetimedb};
Expand All @@ -38,12 +38,12 @@ pub fn say_hello() {
}
EOF

sed -i "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"
run_test cargo run publish --project-path "$PROJECT_PATH" --clear-database
fsed "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"

run_test cargo run publish --project-path "$PROJECT_PATH" --clear-database -d -s
[ "1" == "$(grep -c "reated new database" "$TEST_OUT")" ]
IDENT="$(grep "reated new database" "$TEST_OUT" | awk 'NF>1{print $NF}')"

run_test cargo run call "$IDENT" add '["Robert", 1]'
run_test cargo run call "$IDENT" add '["Julie", 2]'
run_test cargo run call "$IDENT" add '["Samantha", 3]'
Expand Down
8 changes: 4 additions & 4 deletions test/tests/autoinc2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source "./test/lib.include"
do_test() {
echo "RUNNING TEST FOR VALUE: $1"
create_project

cat > "${PROJECT_PATH}/src/lib.rs" << EOF
use spacetimedb::{println, spacetimedb};
Expand Down Expand Up @@ -46,12 +46,12 @@ pub fn say_hello() {
}
EOF

sed -i "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"
fsed "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"

run_test cargo run publish --project-path "$PROJECT_PATH" --clear-database
[ "1" == "$(grep -c "reated new database" "$TEST_OUT")" ]
IDENT="$(grep "reated new database" "$TEST_OUT" | awk 'NF>1{print $NF}')"

run_test cargo run call "$IDENT" update '["Robert", 2]'
run_test cargo run call "$IDENT" add_new '["Success"]'
if run_test cargo run call "$IDENT" add_new '["Failure"]' ; then
Expand Down

0 comments on commit cd8ddd2

Please sign in to comment.