Skip to content

Commit

Permalink
Prepare tests for #32
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmysun committed Aug 26, 2024
1 parent 1c5593f commit 2106590
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tests/docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

cd ..;
set -o posix;

cd "$(dirname "${0}")/.." || exit 1;

echo "Running tests with bash:4.1";
echo "===========================";
Expand Down
12 changes: 10 additions & 2 deletions tests/entry.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/usr/bin/env bash

apk add jq curl perl;
set -o posix;

cd $(dirname "$0");
echo "Setting up prerequisites...";
apk -q add jq curl perl;

echo "Installing ell...";

echo -e '#!/usr/bin/env bash\n\n/ell/ell ${@}' > /usr/local/bin/ell;
chmod +x /usr/local/bin/ell;

cd "$(dirname "${0}")" || exit 1;

echo "Running tests...";

Expand Down
4 changes: 3 additions & 1 deletion tests/logging.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash

set -o posix;

export TO_TTY=true;

source $(dirname "$0")/../helpers/logging.sh;
source "$(dirname "${0}")/../helpers/logging.sh";

export ELL_LOG_LEVEL=5;
echo "ELL_LOG_LEVEL=${ELL_LOG_LEVEL}";
Expand Down
10 changes: 6 additions & 4 deletions tests/parse_output.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -o posix;

echo "";
echo "gemini stream mode to tty";
echo "=========================";
Expand All @@ -10,14 +12,14 @@ export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == "
export ELL_API_KEY="";
export ELL_TEMPLATE_PATH="${PWD}/../templates/";
export ELL_TEMPLATE="default-${ELL_API_STYLE}";
bash ./../ell test;
ell test;

echo "";
echo "gemini no-stream mode to tty";
echo "============================";
export ELL_API_STREAM=false;
export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == "xtrue" ] && echo "" || echo "no-")stream.json#";
bash ./../ell test;
ell test;

export TO_TTY=false;

Expand All @@ -31,11 +33,11 @@ export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == "
export ELL_API_KEY="";
export ELL_TEMPLATE_PATH="${PWD}/../templates/";
export ELL_TEMPLATE="default-${ELL_API_STYLE}";
bash ./../ell test;
ell test;

echo "";
echo "openai no-stream mode to file";
echo "=============================";
export ELL_API_STREAM=false;
export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == "xtrue" ] && echo "" || echo "no-")stream.json#";
bash ./../ell test;
ell test;
4 changes: 3 additions & 1 deletion tests/piping.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -o posix;

function inc() {
while read -r -N 1 char; do
echo -ne $(( (char + 1) % 10 ));
Expand All @@ -8,7 +10,7 @@ function inc() {

export -f inc;

source $(dirname "$0")/../helpers/piping.sh;
source "$(dirname "${0}")/../helpers/piping.sh";

head -c 256 < /dev/zero | tr '\0' '0' | piping inc inc inc inc inc inc inc inc inc inc inc inc;

Expand Down
6 changes: 6 additions & 0 deletions tests/templating.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

set -o posix;

export ELL_TEMPLATE_PATH='/ell/templates/';

echo "openai template test";
ell --api-style ell_echo -m gpt-4o --api-stream false test;

echo "gemini template test";
ell --api-style ell_echo -t default-gemini test;

0 comments on commit 2106590

Please sign in to comment.