Extract infrastructure test as a function