def get_status_query_response(cls): query_response = Response() query_response.responseCode = ResponseCode.OK query_response.result = Result() summaries = GetJobUpdateSummariesResult() query_response.result.getJobUpdateSummariesResult = summaries summaries.updateSummaries = [ JobUpdateSummary( updateId="hello", jobKey=AuroraJobKey('west', 'mcc', 'test', 'hello'), user="******", state=JobUpdateState(status=JobUpdateStatus.ROLLING_FORWARD, createdTimestampMs=1411404927, lastModifiedTimestampMs=14114056030)), JobUpdateSummary( updateId="goodbye", jobKey=AuroraJobKey('west', 'mch', 'prod', 'goodbye'), user="******", state=JobUpdateState(status=JobUpdateStatus.ROLLING_BACK, createdTimestampMs=1411300632, lastModifiedTimestampMs=14114092632)), JobUpdateSummary(updateId="gasp", jobKey=AuroraJobKey('west', 'mcq', 'devel', 'gasp'), user="******", state=JobUpdateState( status=JobUpdateStatus.ROLL_FORWARD_PAUSED, createdTimestampMs=1411600891, lastModifiedTimestampMs=1411800891)) ] return query_response
def get_status_query_response(self, count=3): query_response = Response() query_response.responseCode = ResponseCode.OK query_response.result = Result() summaries = GetJobUpdateSummariesResult() query_response.result.getJobUpdateSummariesResult = summaries summaries.updateSummaries = [JobUpdateSummary( updateId="%s" % i, jobKey=self.TEST_JOBKEY.to_thrift(), user="******", state=JobUpdateState( status=JobUpdateStatus.ROLLED_FORWARD, createdTimestampMs=1411404927, lastModifiedTimestampMs=14114056030)) for i in range(count)] return query_response
def test_status_fails_no_updates(self): response = self.create_simple_success_response() response.result = Result( getJobUpdateSummariesResult=GetJobUpdateSummariesResult(updateSummaries=[])) self._mock_api.query_job_updates.return_value = response assert EXIT_INVALID_PARAMETER == self._command.execute(self._fake_context) assert self._fake_context.get_err()[0] == "No updates found for job west/bozo/test/hello"
def test_status_fails_no_updates(self): response = self.create_simple_success_response() response.result = Result( getJobUpdateSummariesResult=GetJobUpdateSummariesResult(updateSummaries=[])) self._mock_api.query_job_updates.return_value = response assert EXIT_INVALID_PARAMETER == self._command.execute(self._fake_context) assert self._fake_context.get_err() == ["There is no active update for this job."]
def test_update_wait_not_found(self): self._mock_api.query_job_updates.return_value = Response( responseCode=ResponseCode.OK, result=Result(getJobUpdateSummariesResult=GetJobUpdateSummariesResult(updateSummaries=[]))) with pytest.raises(Context.CommandError) as e: self._command.execute(self._fake_context) assert e.value.code == EXIT_INVALID_PARAMETER assert self._fake_context.get_out() == [] assert self._mock_api.query_job_updates.mock_calls == [self._fetch_call]
def get_status_query_response(count=1, status=JobUpdateStatus.ROLLED_FORWARD): return Response( responseCode=ResponseCode.OK, result=Result(getJobUpdateSummariesResult=GetJobUpdateSummariesResult( updateSummaries=[ JobUpdateSummary(key=UPDATE_KEY, user="******", state=JobUpdateState( status=status, createdTimestampMs=1411404927, lastModifiedTimestampMs=14114056030)) for i in range(count) ])))
def get_status_query_response(cls): query_response = Response() query_response.responseCode = ResponseCode.OK query_response.result = Result() summaries = GetJobUpdateSummariesResult() query_response.result.getJobUpdateSummariesResult = summaries summaries.updateSummaries = [ JobUpdateSummary( updateId="hello", jobKey=AuroraJobKey("west", "mcc", "test", "hello"), user="******", state=JobUpdateState( status=JobUpdateStatus.ROLLING_FORWARD, createdTimestampMs=1411404927, lastModifiedTimestampMs=14114056030, ), ), JobUpdateSummary( updateId="goodbye", jobKey=AuroraJobKey("west", "mch", "prod", "goodbye"), user="******", state=JobUpdateState( status=JobUpdateStatus.ROLLING_BACK, createdTimestampMs=1411300632, lastModifiedTimestampMs=14114092632, ), ), JobUpdateSummary( updateId="gasp", jobKey=AuroraJobKey("west", "mcq", "devel", "gasp"), user="******", state=JobUpdateState( status=JobUpdateStatus.ROLL_FORWARD_PAUSED, createdTimestampMs=1411600891, lastModifiedTimestampMs=1411800891, ), ), ] return query_response
def get_status_query_response(cls): query_response = Response() query_response.responseCode = ResponseCode.OK query_response.result = Result() summaries = GetJobUpdateSummariesResult() query_response.result.getJobUpdateSummariesResult = summaries summaries.updateSummaries = [ JobUpdateSummary( updateId="hello", jobKey=AuroraJobKey('west', 'mcc', 'test', 'hello'), user="******", state=JobUpdateState(status=JobUpdateStatus.ROLLING_FORWARD, createdTimestampMs=1411404927, lastModifiedTimestampMs=14114056030)), JobUpdateSummary( updateId="goodbye", jobKey=AuroraJobKey('west', 'mch', 'prod', 'goodbye'), user="******", state=JobUpdateState(status=JobUpdateStatus.ROLLING_BACK, createdTimestampMs=1411300632, lastModifiedTimestampMs=14114092632)), JobUpdateSummary( updateId="gasp", jobKey=AuroraJobKey('west', 'mcq', 'devel', 'gasp'), user="******", state=JobUpdateState(status=JobUpdateStatus.ROLL_FORWARD_PAUSED, createdTimestampMs=1411600891, lastModifiedTimestampMs=1411800891))] return query_response