From 414523b0bf7fc5728d8d118b2823be8610546fe6 Mon Sep 17 00:00:00 2001 From: Reuben Pereira Date: Mon, 2 Sep 2019 14:35:02 +0000 Subject: Handle :9090 and 0.0.0.0:9090 listen_address formats Prometheus listen_address can be in formats of :9090 and 0.0.0.0:9090. But before these can be used to connect a project to Prometheus, they have to converted into absolute URIs. --- .../self_monitoring/project/create_service_spec.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'spec/lib') diff --git a/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb b/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb index b3dedfe1f77..aab6fbcbbd1 100644 --- a/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb +++ b/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb @@ -176,14 +176,28 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do end context 'with non default prometheus address' do + let(:listen_address) { 'https://localhost:9090' } + let(:prometheus_settings) do { enable: true, - listen_address: 'https://localhost:9090' + listen_address: listen_address } end it_behaves_like 'has prometheus service', 'https://localhost:9090' + + context 'with :9090 symbol' do + let(:listen_address) { :':9090' } + + it_behaves_like 'has prometheus service', 'http://localhost:9090' + end + + context 'with 0.0.0.0:9090' do + let(:listen_address) { '0.0.0.0:9090' } + + it_behaves_like 'has prometheus service', 'http://localhost:9090' + end end context 'when prometheus setting is not present in gitlab.yml' do -- cgit v1.2.3