Improve test policy for examples

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-08-30 16:06:39 +02:00
committed by Guillaume de Rouville
parent 02e7cd3f59
commit e7a738211f
3 changed files with 96 additions and 89 deletions

View File

@@ -34,21 +34,15 @@ dagger() {
"${DAGGER}" "$@"
}
# dagger helper to run doc examples in clean environment
# Setup sandbox for dagger example
# It clones the example repository and update Sandbox to
setup_example_sandbox() {
# Tell Dagger not to use DAGGER WORKSPACE env var
unset DAGGER_WORKSPACE
git -C "$DAGGER_SANDBOX" clone https://github.com/dagger/examples
export CODEBLOC_SRC="$(pwd)"
local tmpdir=$(mktemp -d)
cd $tmpdir
if [ "$1" = "doc" ]; then
git clone https://github.com/dagger/examples
cd examples/todoapp
cue mod init
fi
export DAGGER_SANDBOX="$DAGGER_SANDBOX"/examples/todoapp
}
# copy an environment from the current workspace to the sandbox.
#
# this is needed if the test requires altering inputs without dirtying the