Browse Source

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
DEV-4191-DeepInSystem
nprimo 2 years ago committed by Niccolò Primo
parent
commit
ad0ea7ea91
  1. 15
      sh/tests/auto-exec-bin_test.sh
  2. 7
      subjects/devops/auto-exec-bin/README.md

15
sh/tests/auto-exec-bin_test.sh

@ -14,23 +14,20 @@ setupbin() {
echo "bin already exists!" echo "bin already exists!"
else else
mkdir -p ~/myBins mkdir -p ~/myBins
curl -o ~/myBins/01exec https://assets.01-edu.org/devops-branch/01exec echo "echo Hello 01 Scripting Pool" > $HOME/myBins/01exec
chmod +x ~/myBins/01exec
echo "bin installed!"
fi fi
chmod +x $HOME/myBins/01exec
} }
challenge() { challenge() {
OLD_PATH=$PATH
# run soultion script # run soultion script
export PATH="" source "$script_dirS"/$FILENAME
$(bash "$script_dirS"/$FILENAME)
submitted=$(cd / && 01exec) submitted=$(cd / && 01exec)
PATH=$OLD_PATH
# run student script # run student script
export PATH="" source "$script_dirS"/solutions/auto-exec-bin.sh
$(bash "$script_dirS"/solutions/auto-exec-bin.sh)
expected=$(cd / && 01exec) expected=$(cd / && 01exec)
# diff # diff

7
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. 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) You can use any binary from your choice to test your script.
> If our binary is not working in your environment, you can pick any binary for the tests! > You can pick any binary for the tests!
Expected Output: Expected Output:
@ -25,7 +25,8 @@ $
### Hints ### Hints
`PATH` environment variable is a variable where the shell search for the binaries for the execution. `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) ![auto binary exec](https://assets.01-edu.org/devops-branch/auto-exec-diagram.png)

Loading…
Cancel
Save