diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-01 12:07:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-01 12:07:45 +0300 |
commit | b11f7057d067885619ee3e513751f180b2e8ad85 (patch) | |
tree | dfb3077ea8716ed217f5ce4324be4e25a450c599 /spec/lib/gitlab/usage_data_spec.rb | |
parent | e50050a8756a20b6aa118edbad3369674e4c63ba (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/usage_data_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index c148f5e63a5..eca69d755cc 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -147,6 +147,8 @@ describe Gitlab::UsageData, :aggregate_failures do subject { described_class.components_usage_data } it 'gathers components usage data' do + expect(Gitlab::UsageData).to receive(:app_server_type).and_return('server_type') + expect(subject[:app_server][:type]).to eq('server_type') expect(subject[:gitlab_pages][:enabled]).to eq(Gitlab.config.pages.enabled) expect(subject[:gitlab_pages][:version]).to eq(Gitlab::Pages::VERSION) expect(subject[:git][:version]).to eq(Gitlab::Git.version) @@ -159,6 +161,28 @@ describe Gitlab::UsageData, :aggregate_failures do end end + describe '#app_server_type' do + subject { described_class.app_server_type } + + it 'successfully identifies runtime and returns the identifier' do + expect(Gitlab::Runtime).to receive(:identify).and_return(:runtime_identifier) + + is_expected.to eq('runtime_identifier') + end + + context 'when runtime is not identified' do + let(:exception) { Gitlab::Runtime::IdentificationError.new('exception message from runtime identify') } + + it 'logs the exception and returns unknown app server type' do + expect(Gitlab::Runtime).to receive(:identify).and_raise(exception) + + expect(Gitlab::AppLogger).to receive(:error).with(exception.message) + expect(Gitlab::ErrorTracking).to receive(:track_exception).with(exception) + expect(subject).to eq('unknown_app_server_type') + end + end + end + describe '#cycle_analytics_usage_data' do subject { described_class.cycle_analytics_usage_data } |