diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-02 14:41:30 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-02 20:46:29 +0300 |
commit | e21b1501ff16de7657a4a5eccb3b8124ba07709c (patch) | |
tree | 513d81fa14bde7c31987e9377d8929865f174f58 /spec | |
parent | 7b75004d603618d67aa50574bfc80627a6eaf72b (diff) |
Allow enabling Prometheus metrics via ENV variable when db is seeded
Diffstat (limited to 'spec')
-rw-r--r-- | spec/db/production/settings_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/db/production/settings_spec.rb b/spec/db/production/settings_spec.rb new file mode 100644 index 00000000000..c6b772f4e93 --- /dev/null +++ b/spec/db/production/settings_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' +require 'rainbow/ext/string' + +describe 'seed production settings', lib: true do + include StubENV + let(:settings_file) { File.join(__dir__, '../../../db/fixtures/production/010_settings.rb') } + let(:settings) { ApplicationSetting.current || ApplicationSetting.create_from_defaults } + + context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do + before do + stub_env('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN', '013456789') + end + + it 'writes the token to the database' do + load(settings_file) + + expect(settings.runners_registration_token).to eq('013456789') + end + end + + context 'GITLAB_PROMETHEUS_METRICS_ENABLED is set in the environment' do + context 'GITLAB_PROMETHEUS_METRICS_ENABLED is true' do + before do + stub_env('GITLAB_PROMETHEUS_METRICS_ENABLED', 'true') + end + + it 'prometheus_metrics_enabled is set to true ' do + load(settings_file) + + expect(settings.prometheus_metrics_enabled).to eq(true) + end + end + + context 'GITLAB_PROMETHEUS_METRICS_ENABLED is false' do + before do + stub_env('GITLAB_PROMETHEUS_METRICS_ENABLED', 'false') + end + + it 'prometheus_metrics_enabled is set to false' do + load(settings_file) + + expect(settings.prometheus_metrics_enabled).to eq(false) + end + end + end +end |