From 5ca1da839064d49d6d35affc64c45cbc110ea1c2 Mon Sep 17 00:00:00 2001 From: Julian Benitez Gutierrez Date: Wed, 19 Jul 2023 19:37:00 -0500 Subject: [PATCH] Use netstat full ip output --- spec/system/security_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/system/security_spec.rb b/spec/system/security_spec.rb index b33f68ff..a550adfd 100644 --- a/spec/system/security_spec.rb +++ b/spec/system/security_spec.rb @@ -7,9 +7,10 @@ describe 'security' do describe 'the broker' do it 'does not listen publicly on the backend_port' do - netstat_output = bosh.ssh(deployment_name, Helpers::Environment::BROKER_INSTANCE_NAME, "netstat -l | grep #{broker_backend_port}") + netstat_output = bosh.ssh(deployment_name, Helpers::Environment::BROKER_INSTANCE_NAME, "netstat -W -l | grep #{broker_backend_port}") + hostname = bosh.ssh(deployment_name, Helpers::Environment::BROKER_INSTANCE_NAME, "hostname") expect(netstat_output.lines.count).to eq(1) - expect(netstat_output).to include("localhost:#{broker_backend_port}") + expect(netstat_output).to match(/(#{hostname}|localhost):#{broker_backend_port}/) end end end