Skip to content

Commit

Permalink
Merge pull request #158 from booxter/sanity-check
Browse files Browse the repository at this point in the history
Sanity check improvements
  • Loading branch information
booxter authored Dec 5, 2024
2 parents c0249d6 + 8dd0bf2 commit ce64b8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sanity-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
pip install .
- name: Run sanity check
run: |
sh ./sanity-check.sh
./scripts/sanity-check.sh
30 changes: 19 additions & 11 deletions sanity-check.sh → scripts/sanity-check.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#!/bin/sh
#!/bin/bash
set -xe

StringContains() {
string="$1"
substring="$2"

case "$string" in
*"$substring"*)
return 0
;;
*)
return 1
;;
esac
if grep -q "$substring" <<< "$string"; then
return 0
fi
return 1
}

DIRECTORS_FILE=directors.csv

git worktree add ../sanity-check-env
trap "git worktree remove ../sanity-check-env" EXIT

cd ../sanity-check-env

# create empty database
alembic upgrade head

Expand All @@ -30,6 +31,7 @@ cleanup
# start webapp
webapp &
WEBAPP_PID=$!
trap 'kill $WEBAPP_PID; git worktree remove ../sanity-check-env' EXIT
sleep 5

# check that it is running and returns some data
Expand All @@ -43,5 +45,11 @@ out=$(lcli directors get)
StringContains "$out" "Maryam Touzani"
StringContains "$out" "Štefan Uher"

# stop webapp
kill $WEBAPP_PID
# TODO: support structured output for cli, then use it to extract values
out=$(lcli films query --limit 1 --genre drama --offer criterionchannel)
StringContains "$out" "criterionchannel"
StringContains "$out" "drama"
StringContains "$out" ">>>"
StringContains "$out" '⌛:[[:space:]]' && exit 1

exit 0

0 comments on commit ce64b8b

Please sign in to comment.