Skip to content

Commit

Permalink
fix: Improve the way the initial teacher token is read
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmd authored and yurug committed Jun 24, 2021
1 parent 2b3f25b commit 15a7386
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/runtests.sh
Expand Up @@ -146,6 +146,7 @@ handle_file () {

handle_subdir () {
subdir="$(basename "$1")"
token="$2"
pushd "$1" >/dev/null

# init config
Expand All @@ -164,6 +165,14 @@ handle_subdir () {
clean
}

# Get the token from the docker logs
token=$(docker logs "$SERVERID" | grep -e 'Initial teacher token created:' | sed -e 's/^.*: //')

if [ -n "$token" ]; then
red "Failed to get initial teacher token in time"
exit 1
fi

# For each subdirectory (except ./corpuses/*)
while IFS= read -r dir;
do
Expand All @@ -173,13 +182,10 @@ do

echo "---> Entering $dir:"

# Get the token from the sync/ directory
token=$(find sync -maxdepth 5 -mindepth 5 | head -n 1 | sed 's|sync/||' | sed 's|/|-|g')

# For each subdir (i.e. each exercice)
while IFS= read -r subdir;
do
handle_subdir "$subdir"
handle_subdir "$subdir" "$token"
done < <(find . -maxdepth 1 -type d ! -path . ! -path ./repo ! -path ./sync)

popd > /dev/null
Expand Down

0 comments on commit 15a7386

Please sign in to comment.