def testGetBuilderSuccessMap(self): """Tests that the builder success map is properly created.""" board_runattrs = self._run.GetBoardRunAttrs('eve') board_runattrs.SetParallel('success', True) builder_success_map = completion_stages.GetBuilderSuccessMap( self._run, True) expected_map = {self.BOT_ID: True} self.assertEqual(expected_map, builder_success_map)
def GetReportMetadata(self, config=None, stage=None, final_status=None, completion_instance=None): """Generate ReportStage metadata. Args: config: The build config for this run. Defaults to self._run.config. stage: The stage name that this metadata file is being uploaded for. final_status: Whether the build passed or failed. If None, the build will be treated as still running. completion_instance: The stage instance that was used to wait for slave completion. Used to add slave build information to master builder's metadata. If None, no such status information will be included. It not None, this should be a derivative of MasterSlaveSyncCompletionStage. Returns: A JSON-able dictionary representation of the metadata object. """ builder_run = self._run config = config or builder_run.config get_statuses_from_slaves = ( config['master'] and completion_instance and isinstance(completion_instance, completion_stages.MasterSlaveSyncCompletionStage)) child_configs_list = GetChildConfigListMetadata( child_configs=config['child_configs'], config_status_map=completion_stages.GetBuilderSuccessMap( self._run, final_status)) return metadata_lib.CBuildbotMetadata.GetReportMetadataDict( builder_run, get_statuses_from_slaves, config, stage, final_status, completion_instance, child_configs_list)