Skip to content

Commit

Permalink
Add extra scenarios for auto-approve code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ike The Coder committed Aug 15, 2019
1 parent 2624a89 commit 24d5b48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions terraform/scripts/gitops_simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ app.put('/v1/request/close',function(request,response){
app.put('/v1/request/merge',function(request,response){
const scenario = getScenario(request.body.branch);

const resbody = scenario.id == 'happy' ? {status:'ok'} : {status:'error',message:'SIM Error processing request'};
let resbody = scenario.id == 'happy' ? {status:'ok'} : {status:'error',message:'SIM Error processing request'};

if (scenario.id == "s6") {
// Merge request scan in 'pending' or 'running' state or has no pipeline
return {status:'error', code: 4001, message:'Merge request can not be merged. Check that the MR has met all required criteria.'};
resbody = {status:'error', code: 4001, message:'Merge request can not be merged. Check that the MR has met all required criteria.'};
}
if (scenario.id == "s7") {
// Merge request scan in 'failed' state
return {status:'error', code: 4002, message:'Merge request can not be merged.'};
resbody = {status:'error', code: 4002, message:'Merge request can not be merged.'};
}
if (scenario.id == "s8") {
// Merge request successfully merged
return {status:'ok'};
resbody = {status:'ok'};
}

delayedResponse (response, resbody, resbody.status == 'ok' ? 200:400, scenario.delay);
Expand Down

0 comments on commit 24d5b48

Please sign in to comment.