diff --git a/run_in_docker.sh b/run_in_docker.sh index 68188e00..da2f6474 100755 --- a/run_in_docker.sh +++ b/run_in_docker.sh @@ -82,15 +82,17 @@ copy_files() { local cid="$1" local target="$2" local path_to_service="$3" + # shellcheck disable=SC2016 + local remote_path_for_service="$cid:$("$CONTAINER_TOOL" exec "$cid" bash -c 'echo "$HOME"')" case "$target" in "aggregator-tests") copy_go_executable "$cid" "$path_to_service" "insights-results-aggregator" - "$CONTAINER_TOOL" cp "$path_to_service/openapi.json" "$cid":"$("$CONTAINER_TOOL" exec "$cid" bash -c 'echo "$HOME"')" + "$CONTAINER_TOOL" cp "$path_to_service/openapi.json" "$remote_path_for_service" ;; "aggregator-mock-tests") copy_go_executable "$cid" "$path_to_service" "insights-results-aggregator-mock" - "$CONTAINER_TOOL" cp "$path_to_service" "$cid:$("$CONTAINER_TOOL" exec "$cid" bash -c 'echo "$HOME"')/mock_server" + "$CONTAINER_TOOL" cp "$path_to_service" "$remote_path_for_service/mock_server" ;; "cleaner-tests") copy_go_executable "$cid" "$path_to_service" "insights-results-aggregator-cleaner" @@ -114,7 +116,7 @@ copy_files() { "insights-content-service-tests") echo -e "\033[33mWARNING! Content service should include test-rules for these tests to run properly.\033[0m" echo -e "\033[33mPlease build using './build.sh --test-rules-only' or './build.sh --include-test-rules'\033[0m" - "$CONTAINER_TOOL" cp "$path_to_service" "$cid":"$("$CONTAINER_TOOL" exec "$cid" bash -c 'echo "$HOME"')" + "$CONTAINER_TOOL" cp "$path_to_service" "$remote_path_for_service" ;; "insights-content-template-renderer-tests") copy_python_project "$cid" "$path_to_service" @@ -133,7 +135,7 @@ copy_files() { ;; "parquet-factory-tests") copy_go_executable "$cid" "$path_to_service" "parquet-factory" - "$CONTAINER_TOOL" cp "$path_to_service"/config.toml "$cid":"$("$CONTAINER_TOOL" exec "$cid" bash -c 'echo "$HOME"')" + "$CONTAINER_TOOL" cp "$path_to_service"/config.toml "$remote_path_for_service" ;; *) echo "Unexpected target: $target. Does it exist in Makefile?" @@ -166,7 +168,5 @@ cid=$("$CONTAINER_TOOL" ps | grep 'insights-behavioral-spec:latest' | cut -d ' ' # TODO: Discuss including archives in compiled Go executables for testing copy_files "$cid" "$tests_target" "$path_to_service" -# Step 9: Execute the specified make target - - +# Step 7: Execute the specified make target "$CONTAINER_TOOL" exec "$cid" /bin/bash -c "source \$VIRTUAL_ENV/bin/activate && env && $(with_mocked_dependencies "$3") make $tests_target"