Skip to content
Snippets Groups Projects
Commit 308afda689a2 authored by Balasankar 'Balu' C's avatar Balasankar 'Balu' C
Browse files

Merge branch 'sidekiq-hc-disabled-bug' into 'master'

Only check listen address and port if both exporter and health checks are enabled

See merge request gitlab-org/omnibus-gitlab!6086
No related branches found
No related tags found
1 merge request!72Intermediate build for testing purposes
......@@ -11,6 +11,10 @@
default_config = Gitlab['node']['gitlab']['sidekiq']
user_config = Gitlab['sidekiq']
metrics_enabled = user_config['metrics_enabled'].nil? ? default_config['metrics_enabled'] : user_config['metrics_enabled']
health_checks_enabled = user_config['health_checks_enabled'].nil? ? default_config['health_checks_enabled'] : user_config['health_checks_enabled']
return unless metrics_enabled && health_checks_enabled
listen_address = user_config['listen_address'] || default_config['listen_address']
health_checks_address = user_config['health_checks_listen_address'] || default_config['health_checks_listen_address']
listen_port = user_config['listen_port'] || default_config['listen_port']
......
......@@ -137,8 +137,8 @@
end
context 'with sidekiq exporter settings' do
context 'when Sidekiq exporter and Sidekiq health checks addresses are both loopback addresses and the ports are the same' do
context 'when Sidekiq exporter is not enabled' do
before do
stub_gitlab_rb(
sidekiq:
{
......@@ -141,8 +141,8 @@
before do
stub_gitlab_rb(
sidekiq:
{
metrics_enabled: true,
metrics_enabled: false,
listen_address: 'localhost',
listen_port: 3807,
health_checks_enabled: true,
......@@ -152,8 +152,8 @@
)
end
it 'raises an error' do
expect { chef_run }.to raise_error("The Sidekiq metrics and health checks servers are binding the same address and port. This is unsupported in GitLab 15.0 and newer. See https://docs.gitlab.com/ee/administration/sidekiq.html for up-to-date instructions.")
it 'does not raise an error' do
expect { chef_run }.not_to raise_error
end
end
......@@ -157,7 +157,7 @@
end
end
context 'when Sidekiq exporter and Sidekiq health checks port are the same' do
context 'when Sidekiq health checks is not enabled' do
before do
stub_gitlab_rb(
sidekiq:
......@@ -165,10 +165,10 @@
metrics_enabled: true,
listen_address: 'localhost',
listen_port: 3807,
health_checks_enabled: true,
health_checks_listen_address: 'localhost',
health_checks_enabled: false,
health_checks_listen_address: '127.0.0.1',
health_checks_listen_port: 3807
}
)
end
......@@ -170,29 +170,9 @@
health_checks_listen_port: 3807
}
)
end
it 'raises an error' do
expect { chef_run }.to raise_error("The Sidekiq metrics and health checks servers are binding the same address and port. This is unsupported in GitLab 15.0 and newer. See https://docs.gitlab.com/ee/administration/sidekiq.html for up-to-date instructions.")
end
end
context 'when Sidekiq exporter and Sidekiq health checks port are different' do
before do
stub_gitlab_rb(
sidekiq:
{
metrics_enabled: true,
listen_address: 'localhost',
listen_port: 3807,
health_checks_enabled: true,
health_checks_listen_address: 'localhost',
health_checks_listen_port: 3907
}
)
end
it 'does not raise an error' do
expect { chef_run }.not_to raise_error
end
end
......@@ -195,7 +175,69 @@
it 'does not raise an error' do
expect { chef_run }.not_to raise_error
end
end
context 'when both Sidekiq exporter and Sidekiq health checks are enabled' do
context 'when Sidekiq exporter and Sidekiq health checks addresses are both loopback addresses and the ports are the same' do
before do
stub_gitlab_rb(
sidekiq:
{
metrics_enabled: true,
listen_address: 'localhost',
listen_port: 3807,
health_checks_enabled: true,
health_checks_listen_address: '127.0.0.1',
health_checks_listen_port: 3807
}
)
end
it 'raises an error' do
expect { chef_run }.to raise_error("The Sidekiq metrics and health checks servers are binding the same address and port. This is unsupported in GitLab 15.0 and newer. See https://docs.gitlab.com/ee/administration/sidekiq.html for up-to-date instructions.")
end
end
context 'when Sidekiq exporter and Sidekiq health checks port are the same' do
before do
stub_gitlab_rb(
sidekiq:
{
metrics_enabled: true,
listen_address: 'localhost',
listen_port: 3807,
health_checks_enabled: true,
health_checks_listen_address: 'localhost',
health_checks_listen_port: 3807
}
)
end
it 'raises an error' do
expect { chef_run }.to raise_error("The Sidekiq metrics and health checks servers are binding the same address and port. This is unsupported in GitLab 15.0 and newer. See https://docs.gitlab.com/ee/administration/sidekiq.html for up-to-date instructions.")
end
end
context 'when Sidekiq exporter and Sidekiq health checks port are different' do
before do
stub_gitlab_rb(
sidekiq:
{
metrics_enabled: true,
listen_address: 'localhost',
listen_port: 3807,
health_checks_enabled: true,
health_checks_listen_address: 'localhost',
health_checks_listen_port: 3907
}
)
end
it 'does not raise an error' do
expect { chef_run }.not_to raise_error
end
end
end
end
context 'with sidekiq exporter settings not set (default settings)' do
......
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