Skip to content

Instantly share code, notes, and snippets.

@lhuard1A
Last active October 13, 2015 09:57
Show Gist options
  • Save lhuard1A/2ce34aee6d1fdcbbb257 to your computer and use it in GitHub Desktop.
Save lhuard1A/2ce34aee6d1fdcbbb257 to your computer and use it in GitHub Desktop.
#!/bin/bash
rm -f /tmp/concurrent_docker_pulls-*
declare -a childPid
readonly nbConcurrentPulls=30
for i in $(eval echo "{1..$nbConcurrentPulls}"); do
docker run l3n41c/test-$i > /tmp/concurrent_docker_pulls-$i 2>&1 &
childPid[$i]=$!
done
for i in $(eval echo "{1..$nbConcurrentPulls}"); do
wait ${childPid[$i]}
done
result=ok
for i in $(eval echo "{1..$nbConcurrentPulls}"); do
if [[ $(tail -n1 /tmp/concurrent_docker_pulls-$i) != "Test $i" ]]; then
result=ko
fi
done
if [[ $result == "ok" ]]; then
echo "Success"
exit 0
else
echo "Failed"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment