Restructure test code to limit concurrency.