Serverspec test statements for content linking to sections in file

96 Views Asked by At

I have a file, with sections of content as following. I need to write server spec test file for portnumbers as it belongs to their respective section, as a part of puppet automation of a product.

path: etc/a.Cfg file

Global
 user abc
 group aaa

frontend one
 bind 10.1.0.15:80
 option tcp

frontend two
 bind 10.1.1.25:666
 option tcp 

frontend three 
 bind 10.2.2.45:444
 option tcp

I need to write serverspec test as if port 666 exits and is belonging to section frontend two. And similar way for 444, and 80 ports to exist and belong to their respective sections

I haave already created soe serverspec test statements which are related to checking if these sections exist. like serverspec.rb

 # to check frontend one is exst on server/VM for testing
describe file('a.cfg') do
  it { is_expected.to contain %r{^frontend one} } 
end

Similar way bt im not sure how to to write serverspec test as if port 666 exits and is belonging to section frontend two. And similar way for 444, and 80 ports to exist and belong to their respective sections

please help who know puppet, or serverspec.

0

There are 0 best solutions below