Last active
October 8, 2015 22:13
-
-
Save cbednarski/be7f677a2ba96209c431 to your computer and use it in GitHub Desktop.
Script to rerun a test to catch a race condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import subprocess | |
import os | |
small_before_re = re.compile("(\w+) /tmp/small") | |
big_before_re = re.compile("(\w+) /tmp/big") | |
small_after_re = re.compile("(\w+) small") | |
big_after_re = re.compile("(\w+) big") | |
os.putenv("PACKER_LOG", "1") | |
while True: | |
output = subprocess.check_output(["packer", "build", "docker-download.json"], stderr=subprocess.STDOUT) | |
small_before = small_before_re.findall(output)[0] | |
big_before = big_before_re.findall(output)[0] | |
small_after = small_after_re.findall(output)[0] | |
big_after = big_after_re.findall(output)[0] | |
print "small {0} {1}".format(small_before, small_after) | |
print "big {0} {1}".format(big_before, big_after) | |
if small_before != small_after: | |
print output | |
exit(1) | |
if big_before != big_after: | |
print output | |
exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment