Skip to content

Commit daf00ad

Browse files
committed
Remove stringify conversion in deployment model
1 parent dfff017 commit daf00ad

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

app/models/runtime/deployment_model.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ def before_update
9494
def before_create
9595
self.canary_current_step = 1 if strategy == DeploymentModel::CANARY_STRATEGY
9696

97-
unless canary_steps.nil?
98-
# ensure that canary steps are in the correct format for serialization
99-
self.canary_steps = canary_steps.map(&:stringify_keys)
100-
end
97+
# unless canary_steps.nil?
98+
# # ensure that canary steps are in the correct format for serialization
99+
# self.canary_steps = canary_steps.map(&:stringify_keys)
100+
# end
101101
super
102102
end
103103

db/migrations/20250130172009_add_canary_steps_to_deployments.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Sequel.migration do
22
up do
33
alter_table(:deployments) do
4-
# TODO: what size?
54
add_column :canary_steps, String, size: 4096
65
add_column :canary_current_step, :integer
76
end

spec/unit/actions/deployment_create_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ module VCAP::CloudController
610610

611611
it 'saves the canary steps' do
612612
deployment = DeploymentCreate.create(app:, message:, user_audit_info:)
613+
deployment.reload
613614
expect(deployment.canary_steps).to eq([{ 'instance_weight' => 40 }, { 'instance_weight' => 80 }])
614615
end
615616
end
@@ -1151,7 +1152,7 @@ module VCAP::CloudController
11511152
strategy: strategy,
11521153
options: {
11531154
max_in_flight: max_in_flight,
1154-
canary: { steps: [{ instance_weight: 66 }, { instance_weight: 99 }] }
1155+
canary: { steps: [{ instance_weight: 33 }, { instance_weight: 99 }] }
11551156
}
11561157
})
11571158
end
@@ -1163,7 +1164,9 @@ module VCAP::CloudController
11631164
deployment = DeploymentCreate.create(app:, message:, user_audit_info:)
11641165
end.to change(DeploymentModel, :count).by(1)
11651166

1166-
expect(deployment.canary_steps).to eq([{ 'instance_weight' => 66 }, { 'instance_weight' => 99 }])
1167+
deployment.reload
1168+
1169+
expect(deployment.canary_steps).to eq([{ 'instance_weight' => 33 }, { 'instance_weight' => 99 }])
11671170
end
11681171

11691172
it 'sets starting instances to max in flight' do
@@ -1180,7 +1183,7 @@ module VCAP::CloudController
11801183
DeploymentCreate.create(app:, message:, user_audit_info:)
11811184

11821185
deploying_web_process = app.reload.newest_web_process
1183-
expect(deploying_web_process.instances).to eq(2)
1186+
expect(deploying_web_process.instances).to eq(1)
11841187
end
11851188
end
11861189
end

0 commit comments

Comments
 (0)