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 1 year 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!"
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

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.
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)

Loading…
Cancel
Save