Fix data race in test writer
If something is worth doing, it's worth overdoing
Merge pull request #2 from juju/100-fix-race-in-test-writer

Fix data race in test writer