Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanity check improvements #158

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading