Skip to content

Commit

Permalink
e2e: improve CLI test script
Browse files Browse the repository at this point in the history
Signed-off-by: Isabella do Amaral <[email protected]>
  • Loading branch information
isinyaaa committed Nov 5, 2024
1 parent 1806c24 commit b773b29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test:

.PHONY: test-e2e
test-e2e:
poetry run pytest --e2e -s -x -rA
poetry run pytest --e2e -s -x -rA -v

.PHONY: test-e2e-model-registry
test-e2e-model-registry:
Expand Down
23 changes: 12 additions & 11 deletions e2e/test_cli.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash

SCRIPT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")"
set -e

echo "Preparing venv ..."
Expand All @@ -15,21 +14,23 @@ echo "Running E2E test for CLI ..."
omlmd push localhost:5001/mmortari/mlartifact:v1 README.md --empty-metadata --plain-http
omlmd push localhost:5001/mmortari/mlartifact:v1 README.md --metadata tests/data/md.json --plain-http

omlmd pull localhost:5001/mmortari/mlartifact:v1 -o tmp/a --plain-http
file_count=$(find "tmp/a" -type f | wc -l)
DIR="tmp/a"
omlmd pull localhost:5001/mmortari/mlartifact:v1 -o "$DIR" --plain-http
file_count=$(find "$DIR" -type f | wc -l)
if [ "$file_count" -eq 3 ]; then
echo "Expected 3 files in $DIR, ok."
else
echo "I was expecting 3 files in $DIR, FAIL."
echo "Expected 3 files in $DIR, got $file_count, FAIL."
exit 1
fi

omlmd pull localhost:5001/mmortari/mlartifact:v1 -o tmp/b --media-types "application/x-mlmodel" --plain-http
file_count=$(find "tmp/b" -type f | wc -l)
DIR="tmp/b"
omlmd pull localhost:5001/mmortari/mlartifact:v1 -o "$DIR" --media-types "application/x-mlmodel" --plain-http
file_count=$(find "$DIR" -type f | wc -l)
if [ "$file_count" -eq 1 ]; then
echo "Expected 1 files in $DIR, ok."
echo "Expected 1 file in $DIR, ok."
else
echo "I was expecting 1 files in $DIR, FAIL."
echo "Expected 1 file in $DIR, got $file_count, FAIL."
exit 1
fi

Expand All @@ -38,7 +39,7 @@ omlmd crawl localhost:5001/mmortari/mlartifact:v1 localhost:5001/mmortari/mlarti
omlmd crawl --plain-http \
localhost:5001/mmortari/mlartifact:v1 \
localhost:5001/mmortari/mlartifact:v1 \
localhost:5001/mmortari/mlartifact:v1 \
| jq "max_by(.config.customProperties.accuracy).reference"
localhost:5001/mmortari/mlartifact:v1 |
jq "max_by(.config.customProperties.accuracy).reference"

deactivate

0 comments on commit b773b29

Please sign in to comment.