Commit cc3adcd4 authored by Timothy Andrew's avatar Timothy Andrew

Fix `CreateDeploymentService` spec.

1. The spec tests that if:

  - The merge request is merged
  - The target branch is deployed to production
  - The `first_deployed_to_production_at` metric is `nil` (for some reason)
  - The target branch is deployed to production again
  - The `first_deployed_to_production_at` metric stays as `nil` (and is
    not overwritten).

2. Failure only on MySQL due to some datetime weirdness.
parent ef8badb6
......@@ -229,8 +229,11 @@ describe CreateDeploymentService, services: true do
context "if the 'first_deployed_to_production_at' time is not already set" do
it "does not overwrite the older 'first_deployed_to_production_at' time" do
# Previous deploy
time =
time = 5.minutes.from_now
Timecop.freeze(time) { service.execute }
expect(merge_request.reload.metrics.merged_at).to be < merge_request.reload.metrics.first_deployed_to_production_at
merge_request.reload.metrics.update(first_deployed_to_production_at: nil)
expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_nil
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment