Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-01-06 17:51:06 +0300
committerToon Claes <toon@gitlab.com>2017-01-09 18:35:24 +0300
commitb74677489a915570a182e624fc2c7ad537c8e75e (patch)
tree3d5a62743ea52d9e70e7a18402623ee95fd30fcc /spec/models/environment_spec.rb
parent8ab94120ee0a87c7b1158ebafea101e3952ec758 (diff)
Treat environments matching `production/*` as Production
For Cycle Analytics, the environment `production` is treated as a special case, and used to update the `first_deployed_to_production_at` metric. With the Review Apps changes, slash syntax is used to group related environments in the list. This is mostly used for `review/<branch>` environments, but it's possible for people to have multiple production environments, and someone might then want to group them like `production/eu`, `production/us`, or even just make it look prettier with `production/www.example.com`. In any of these cases, the first deploy to one of these `production/*` environments now is treated as a Production deploy.
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r--spec/models/environment_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index 93eb402e060..96efe1696c3 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -63,6 +63,23 @@ describe Environment, models: true do
end
end
+ describe '#update_merge_request_metrics?' do
+ { 'production' => true,
+ 'production/eu' => true,
+ 'production/www.gitlab.com' => true,
+ 'productioneu' => false,
+ 'Production' => false,
+ 'Production/eu' => false,
+ 'test-production' => false
+ }.each do |name, expected_value|
+ it "returns #{expected_value} for #{name}" do
+ env = create(:environment, name: name)
+
+ expect(env.update_merge_request_metrics?).to eq(expected_value)
+ end
+ end
+ end
+
describe '#first_deployment_for' do
let(:project) { create(:project) }
let!(:deployment) { create(:deployment, environment: environment, ref: commit.parent.id) }