Skip to content

Commit

Permalink
Merge pull request #90 from redBorder/improvement/#17692_skip_single_…
Browse files Browse the repository at this point in the history
…node_tests

#17692 IS_CLUSTER as env param to skip sync interface and number of nodes
  • Loading branch information
rgomezborder authored Dec 4, 2024
2 parents eedc20b + 1dbc9af commit e6fca30
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
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

0 comments on commit e6fca30

Please sign in to comment.