diff options
author | Toon Claes <toon@gitlab.com> | 2017-01-06 15:51:06 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-01-09 16:35:24 +0100 |
commit | b74677489a915570a182e624fc2c7ad537c8e75e (patch) | |
tree | 3d5a62743ea52d9e70e7a18402623ee95fd30fcc /spec/models/environment_spec.rb | |
parent | 8ab94120ee0a87c7b1158ebafea101e3952ec758 (diff) | |
download | gitlab-ce-b74677489a915570a182e624fc2c7ad537c8e75e.tar.gz |
Treat environments matching `production/*` as Production24139-production-wildcard-for-cycle-analytics
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.rb | 17 |
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) } |