From b272acbcf3e8b8890cfa2e2a577c3e2a7b761ed1 Mon Sep 17 00:00:00 2001 From: georgetarazevich Date: Thu, 14 Dec 2023 18:21:33 +0300 Subject: [PATCH] Update test for debug option to check logs in the container --- tests/Options/config/validator/debug.bats | 7 +++++-- tests/tools/test_helper/common-setup.bash | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/Options/config/validator/debug.bats b/tests/Options/config/validator/debug.bats index 05bc4e96..5e520ab1 100644 --- a/tests/Options/config/validator/debug.bats +++ b/tests/Options/config/validator/debug.bats @@ -21,7 +21,10 @@ teardown() { @test "--debug, Outputs all processed file names, debug=true" { run curl -F "file=@$PROJECT_ROOT/Resources/a.pdf" localhost:8080/api/validate/1b -H "Accept:text/html" - assert_output --partial "a.pdf" - [ "$status" -eq 0 ] + + sleep 5 # sleep 5 sec + + run docker logs $DOCKER_CONTAINER -t --since=$test_logs_starting_time + assert_output --partial "INFO: a.pdf" } diff --git a/tests/tools/test_helper/common-setup.bash b/tests/tools/test_helper/common-setup.bash index 3240fc4c..d06f54de 100755 --- a/tests/tools/test_helper/common-setup.bash +++ b/tests/tools/test_helper/common-setup.bash @@ -9,6 +9,10 @@ _common_setup() { export DOCKER_CONTAINER=$(echo $(docker ps | grep "rest:" | awk '{print $1}')) echo -e "\nDOCKER_CONTAINER_ID: $DOCKER_CONTAINER \n" >&3 + + echo "Checking docker container logs...at:" >&3 + export test_logs_starting_time=$(date +%s) + echo $(date -d @"$test_logs_starting_time") >&3 } remove_verapdf_config_files() {