Remove duplicated code in test_versions

There is duplicated code in test_versions.
This patch removes it for cleanup.

Change-Id: Id8ff2147e624a89476a65c3f0ded54bdb26e53ad
Merge "Remove duplicated code in test_versions"