gitlab-org--gitlab-foss/spec/db/production/settings.rb
DJ Mountney fb5f7733f1 Allow users to seed the initial runner registration token using an environment variable
This is useful for when runner is bundled with gitlab, like in a kubernetes stack, and we want the runner to be able to
register with gitlab as soon as they both come up.
2016-12-01 17:21:21 -08:00

16 lines
596 B
Ruby

require 'spec_helper'
require 'rainbow/ext/string'
describe 'seed production settings', lib: true do
context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do
before do
allow(ENV).to receive(:[]).and_call_original
allow(ENV).to receive(:[]).with('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN').and_return('013456789')
end
it 'writes the token to the database' do
load(File.join(__dir__, '../../../db/fixtures/production/010_settings.rb'))
expect(ApplicationSetting.current.runners_registration_token).to eq('013456789')
end
end
end