diff --git a/spec/configuration/network_spec.rb b/spec/configuration/network_spec.rb index ec3ace8..abaa49b 100644 --- a/spec/configuration/network_spec.rb +++ b/spec/configuration/network_spec.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 247cb12..eec33ee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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'] @@ -19,5 +24,4 @@ else ENV['LOGIN_PASSWORD'] || 'redborder' end - set :ssh_options, options