def _BuildTestMatrix(self, spec): """Build just the user-specified parts of an iOS TestMatrix message. Args: spec: a TestSpecification message corresponding to the test type. Returns: A TestMatrix message. """ devices = [self._BuildIosDevice(d) for d in self._args.device] environment_matrix = self._messages.EnvironmentMatrix( iosDeviceList=self._messages.IosDeviceList(iosDevices=devices)) gcs = self._messages.GoogleCloudStorage(gcsPath=self._gcs_results_root) hist = self._messages.ToolResultsHistory(projectId=self._project, historyId=self._history_id) results = self._messages.ResultStorage(googleCloudStorage=gcs, toolResultsHistory=hist) client_info = matrix_creator_common.BuildClientInfo( self._messages, getattr(self._args, 'client_details', {}) or {}, self._release_track) return self._messages.TestMatrix( testSpecification=spec, environmentMatrix=environment_matrix, clientInfo=client_info, resultStorage=results, flakyTestAttempts=self._args.num_flaky_test_attempts or 0)
def testBuildClientInfoAppendsUserProvidedClientDetails(self): client_info = matrix_creator_common.BuildClientInfo( self.testing_msgs, { 'k1': 'v1', 'k2': 'v2' }, '') self.assertIn(self.testing_msgs.ClientInfoDetail(key='k1', value='v1'), client_info.clientInfoDetails) self.assertIn(self.testing_msgs.ClientInfoDetail(key='k2', value='v2'), client_info.clientInfoDetails)
def testBuildClientInfoOverwritesDefaultDetails(self): client_info = matrix_creator_common.BuildClientInfo( self.testing_msgs, { 'Cloud SDK Version': 'a', 'Release Track': 'a', }, 'release_track') self.assertIn( self.testing_msgs.ClientInfoDetail(key='Cloud SDK Version', value=config.CLOUD_SDK_VERSION), client_info.clientInfoDetails) self.assertIn( self.testing_msgs.ClientInfoDetail(key='Release Track', value='release_track'), client_info.clientInfoDetails)