Skip to content
Snippets Groups Projects
Commit 42f0da59 authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Add specs for config.toml changes.

parent 23018de1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6,6 +6,7 @@ omnibus-gitlab repository.
9.1.0
 
- Remove deprecated satellites configuration
- Add configuration file for Gitaly
 
9.0.4
 
Loading
Loading
Loading
Loading
@@ -227,7 +227,7 @@ templatesymlink "Create a relative_url.rb and create a symlink to Rails root" do
end
end
 
gitaly_socket = node['gitlab']['gitaly']['socket_path'] if node['gitlab']['gitaly']['enable']
gitaly_socket = node['gitlab']['gitaly']['env']['GITALY_SOCKET_PATH'] if node['gitlab']['gitaly']['enable']
 
templatesymlink "Create a gitlab.yml and create a symlink to Rails root" do
link_from File.join(gitlab_rails_source_dir, "config/gitlab.yml")
Loading
Loading
Loading
Loading
@@ -2,16 +2,14 @@ require 'chef_helper'
 
describe 'gitlab::gitaly' do
let(:chef_run) { ChefSpec::SoloRunner.converge('gitlab::default') }
config_path = '/var/opt/gitlab/gitaly/config.toml'
let(:gitaly_config) { chef_run.template(config_path) }
 
before do
allow(Gitlab).to receive(:[]).and_call_original
end
 
context 'when gitaly is enabled' do
before do
stub_gitlab_rb(gitaly: { enable: true })
end
context 'by default' do
it_behaves_like "enabled runit service", "gitaly", "root", "root"
 
it 'creates expected directories with correct permissions' do
Loading
Loading
@@ -20,6 +18,36 @@ describe 'gitlab::gitaly' do
expect(chef_run).to create_directory('/opt/gitlab/etc/gitaly')
expect(chef_run).to create_file('/opt/gitlab/etc/gitaly/PATH')
end
it 'populates gitaly config.toml with defaults' do
expect(chef_run).to render_file(config_path)
.with_content("socket_path = '/var/opt/gitlab/gitaly/gitaly.socket'")
expect(chef_run).not_to render_file(config_path)
.with_content("listen_addr = 'localhost:7777'")
expect(chef_run).not_to render_file(config_path)
.with_content("prometheus_listen_addr = 'localhost:9000'")
end
end
context 'with user settings' do
before do
stub_gitlab_rb(
gitaly: {
socket_path: '/tmp/gitaly.socket',
listen_addr: 'localhost:7777',
prometheus_listen_addr: 'localhost:9000'
}
)
end
it 'populates gitaly config.toml with custom values' do
expect(chef_run).to render_file(config_path)
.with_content("socket_path = '/tmp/gitaly.socket'")
expect(chef_run).to render_file(config_path)
.with_content("listen_addr = 'localhost:7777'")
expect(chef_run).to render_file(config_path)
.with_content("prometheus_listen_addr = 'localhost:9000'")
end
end
 
context 'when gitaly is disabled' do
Loading
Loading
@@ -33,6 +61,7 @@ describe 'gitlab::gitaly' do
expect(chef_run).not_to create_directory('/var/opt/gitlab/gitaly')
expect(chef_run).not_to create_directory('/var/log/gitlab/gitaly')
expect(chef_run).not_to create_directory('/opt/gitlab/etc/gitaly')
expect(chef_run).not_to create_file('/var/opt/gitlab/gitaly/config.toml')
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment