Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#17692 IS_CLUSTER as env param to skip sync interface and number of nodes #90

Merged
merged 6 commits into from
Dec 4, 2024
26 changes: 26 additions & 0 deletions spec/configuration/network_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@
end
end

# Management network
puts 'Configuration'

ip = ENV['TARGET_HOST']
puts "HOST: #{ip}"

describe 'Management network' do
it 'The Management network should contain an IP' do
expect(ip).to match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
end
end

# Sync network
describe 'Sync network' do
sync = command('ip addr show').stdout
it 'Have a network sync' do
interfaces_with_ip = sync.scan(/inet\s+(\d+\.\d+\.\d+\.\d+)/).flatten
if ENV['IS_CLUSTER']
expect(interfaces_with_ip.length).to be >= 3
else
skip 'One node does not need sync interface'
end
puts "OUTPUT: #{interfaces_with_ip}"
end
end

# DNS
describe 'DNS' do
resolv_content = command('cat /etc/resolv.conf').stdout
Expand Down
6 changes: 5 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
set :backend, :ssh
set :disable_sudo, true

# spec/spec_helper.rb

# Check if IS_CLUSTER environment variable is already set
ENV['IS_CLUSTER'] ||= 'true' unless ENV.key?('IS_CLUSTER') && ENV['IS_CLUSTER'] == 'false'

# ssh setup
ENV['TARGET_HOST'] ||= '10.0.209.20'
host = ENV['TARGET_HOST']
Expand All @@ -19,5 +24,4 @@
else
ENV['LOGIN_PASSWORD'] || 'redborder'
end

set :ssh_options, options
Loading