Commit 5eb2f8f8 authored by Alishan Ladhani's avatar Alishan Ladhani Committed by Mayra Cabrera

Fix issue with non-canary prod events

They were being labelled as development
parent 44b5c7a0
...@@ -15,10 +15,14 @@ module Gitlab ...@@ -15,10 +15,14 @@ module Gitlab
end end
def environment def environment
return 'production' if Gitlab.com_and_canary?
return 'staging' if Gitlab.staging? return 'staging' if Gitlab.staging?
return 'production' if Gitlab.com?
return 'org' if Gitlab.org?
return 'self-managed' if Rails.env.production?
'development' 'development'
end end
......
...@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do ...@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do
context 'staging' do context 'staging' do
before do before do
allow(Gitlab).to receive(:staging?).and_return(true) stub_config_setting(url: 'https://staging.gitlab.com')
end end
include_examples 'contains environment', 'staging' include_examples 'contains environment', 'staging'
...@@ -30,11 +30,27 @@ RSpec.describe Gitlab::Tracking::StandardContext do ...@@ -30,11 +30,27 @@ RSpec.describe Gitlab::Tracking::StandardContext do
context 'production' do context 'production' do
before do before do
allow(Gitlab).to receive(:com_and_canary?).and_return(true) stub_config_setting(url: 'https://gitlab.com')
end end
include_examples 'contains environment', 'production' include_examples 'contains environment', 'production'
end end
context 'org' do
before do
stub_config_setting(url: 'https://dev.gitlab.org')
end
include_examples 'contains environment', 'org'
end
context 'other self-managed instance' do
before do
stub_rails_env('production')
end
include_examples 'contains environment', 'self-managed'
end
end end
it 'contains source' do it 'contains source' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment