From 43776f0c90c887cd36b7cb196163f42a68702e01 Mon Sep 17 00:00:00 2001 From: Nivedita Priyadarshini Date: Wed, 11 Oct 2023 14:01:39 +0530 Subject: [PATCH] Do not finish deployment run when staged rollout is halted --- app/models/staged_rollout.rb | 1 - spec/models/staged_rollout_spec.rb | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/staged_rollout.rb b/app/models/staged_rollout.rb index c9f338293..2772bbafd 100644 --- a/app/models/staged_rollout.rb +++ b/app/models/staged_rollout.rb @@ -69,7 +69,6 @@ class StagedRollout < ApplicationRecord end event :halt, guard: -> { deployment_run.rolloutable? }, after_commit: -> { event_stamp!(reason: :halted, kind: :notice, data: stamp_data) } do - after { deployment_run.complete! } transitions from: [:started, :paused, :failed], to: :stopped end diff --git a/spec/models/staged_rollout_spec.rb b/spec/models/staged_rollout_spec.rb index 9d98c7604..5ce8f4564 100644 --- a/spec/models/staged_rollout_spec.rb +++ b/spec/models/staged_rollout_spec.rb @@ -90,11 +90,11 @@ expect(rollout.reload.stopped?).to be(true) end - it "completes the deployment run if halt succeeds" do + it "does not complete the deployment run if halt succeeds" do allow(providable_dbl).to receive(:halt_release).and_return(GitHub::Result.new) rollout.halt_release! - expect(rollout.deployment_run.reload.released?).to be(true) + expect(rollout.deployment_run.reload.released?).to be(false) end it "does not complete the deployment run if halt fails" do @@ -134,11 +134,11 @@ expect(rollout.reload.stopped?).to be(true) end - it "marks deployment run is completed" do + it "does not mark deployment run is completed" do allow(providable_dbl).to receive(:halt_phased_release).and_return(GitHub::Result.new) rollout.halt_release! - expect(deployment_run.reload.released?).to be(true) + expect(deployment_run.reload.released?).to be(false) end it "does not complete the deployment run if rollout fails" do