From ad0ea7ea91876ffca759426ac8d5907fd7b6c121 Mon Sep 17 00:00:00 2001 From: nprimo Date: Thu, 12 Jan 2023 16:33:12 +0000 Subject: [PATCH] fix(auto-exec-bin): fix test bug - replace bash command with source to update current bash PATH and not a sub-bash one - replace binary with simple bash script - image has no access to internet - update subject accordingly --- sh/tests/auto-exec-bin_test.sh | 15 ++++++--------- subjects/devops/auto-exec-bin/README.md | 7 ++++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sh/tests/auto-exec-bin_test.sh b/sh/tests/auto-exec-bin_test.sh index 2fb9157f1..54e0c67ca 100755 --- a/sh/tests/auto-exec-bin_test.sh +++ b/sh/tests/auto-exec-bin_test.sh @@ -14,23 +14,20 @@ setupbin() { echo "bin already exists!" else mkdir -p ~/myBins - curl -o ~/myBins/01exec https://assets.01-edu.org/devops-branch/01exec - chmod +x ~/myBins/01exec - echo "bin installed!" + echo "echo Hello 01 Scripting Pool" > $HOME/myBins/01exec fi + chmod +x $HOME/myBins/01exec } challenge() { + OLD_PATH=$PATH # run soultion script - export PATH="" - - $(bash "$script_dirS"/$FILENAME) + source "$script_dirS"/$FILENAME submitted=$(cd / && 01exec) + PATH=$OLD_PATH # run student script - export PATH="" - - $(bash "$script_dirS"/solutions/auto-exec-bin.sh) + source "$script_dirS"/solutions/auto-exec-bin.sh expected=$(cd / && 01exec) # diff diff --git a/subjects/devops/auto-exec-bin/README.md b/subjects/devops/auto-exec-bin/README.md index dde7a3707..01ba16d9a 100644 --- a/subjects/devops/auto-exec-bin/README.md +++ b/subjects/devops/auto-exec-bin/README.md @@ -4,8 +4,8 @@ Create a file `auto-exec-bin.sh`, which will make a binary with the name `01exec` in `~/myBins` executable from any working directory. -You can use any binary from your choice or you can use our binary: [01exec](https://assets.01-edu.org/devops-branch/01exec) -> If our binary is not working in your environment, you can pick any binary for the tests! +You can use any binary from your choice to test your script. +> You can pick any binary for the tests! Expected Output: @@ -25,7 +25,8 @@ $ ### Hints `PATH` environment variable is a variable where the shell search for the binaries for the execution. -when you put a command the shell will search for binary in `PATH` folders + +When you put a command the shell will search for binary in `PATH` folders ![auto binary exec](https://assets.01-edu.org/devops-branch/auto-exec-diagram.png)