From b773b294fe903bb1134d74e3f09d285b93731618 Mon Sep 17 00:00:00 2001 From: Isabella do Amaral Date: Thu, 31 Oct 2024 18:32:25 -0300 Subject: [PATCH] e2e: improve CLI test script Signed-off-by: Isabella do Amaral --- Makefile | 2 +- e2e/test_cli.sh | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 5803fa4..3329828 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/e2e/test_cli.sh b/e2e/test_cli.sh index 4e8954d..919d3bd 100755 --- a/e2e/test_cli.sh +++ b/e2e/test_cli.sh @@ -1,6 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash -SCRIPT_DIR="$(dirname "$(realpath "$BASH_SOURCE")")" set -e echo "Preparing venv ..." @@ -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 @@ -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