Backport version parsing in tests from 2.1 branch.