Skip to content

Commit

Permalink
adding other consul ports
Browse files Browse the repository at this point in the history
  • Loading branch information
ljblancoredborder committed Dec 5, 2024
1 parent f145629 commit 5c48d62
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions spec/services/consul_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]

service = 'consul'
port = 8300
ports = [8300, 8301, 8302, 8500]
api_endpoint = 'http://localhost:8500/v1'

describe "Checking packages for #{service}..." do
Expand All @@ -29,15 +29,17 @@
service_status = command("systemctl is-enabled #{service}").stdout
service_status = service_status.strip

if service_status == 'enabled'
describe "Checking #{service_status} service for #{service}..." do
describe "Checking #{service_status} service for #{service}..." do
if service_status == 'enabled'
describe service(service) do
it { should be_enabled }
it { should be_running }
end

describe port(port) do
it { should be_listening }
ports.each do |p|
describe port(p) do
it { should be_listening }
end
end

# Use this block to test other services that need to be registered in consul
Expand All @@ -58,16 +60,21 @@
end
end
end
end

if service_status == 'disabled'
describe "Checking #{service_status} service for #{service}..." do
if service_status == 'disabled'
describe service(service) do
it { should_not be_enabled }
it { should_not be_running }
end

describe port(port) do
# Cannot disable consul, so test if you can and uncomment
# in case of successful test
# ports.each do |p|
# describe port(p) do
# it { should_not be_listening }
# end
# end
describe port(8300) do
it { should_not be_listening }
end
end
Expand Down

0 comments on commit 5c48d62

Please sign in to comment.