File tree Expand file tree Collapse file tree 2 files changed +42
-3
lines changed
Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Original file line number Diff line number Diff line change 8181# }]
8282# }
8383class datadog_agent::integrations::tcp_check (
84- String $check_name,
85- String $host,
86- String $port,
84+ Optional[ String] $check_name = undef ,
85+ Optional[ String] $host = undef ,
86+ Optional[ String] $port = undef ,
8787 Integer $timeout = 10,
8888 Optional[Integer] $threshold = undef ,
8989 Optional[Integer] $window = undef ,
Original file line number Diff line number Diff line change 112112
113113 skip ( 'doubly undefined behavior' )
114114 end
115+
116+ context 'with multiple instances' do
117+ let ( :params ) do
118+ {
119+ instances : [
120+ {
121+ check_name : 'foo.bar.baz' ,
122+ host : 'foo.bar.baz' ,
123+ port : '80' ,
124+ timeout : 123 ,
125+ threshold : 456 ,
126+ window : 789 ,
127+ collect_response_time : true ,
128+ } ,
129+ {
130+ check_name : 'baz.bar.foo' ,
131+ host : 'baz.bar.foo' ,
132+ port : '8080' ,
133+ timeout : 456 ,
134+ tags : [ 'foo' , 'bar' , 'baz' ]
135+ } ,
136+ ]
137+ }
138+ end
139+
140+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{name: foo.bar.baz} ) }
141+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{host: foo.bar.baz} ) }
142+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{port: 80} ) }
143+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{timeout: 123} ) }
144+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{threshold: 456} ) }
145+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{window: 789} ) }
146+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{collect_response_time: true} ) }
147+
148+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{name: baz.bar.foo} ) }
149+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{host: baz.bar.foo} ) }
150+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{port: 8080} ) }
151+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{timeout: 456} ) }
152+ it { is_expected . to contain_file ( conf_file ) . with_content ( %r{tags:\s +- foo\s +- bar\s +- baz\s *?[^-]}m ) }
153+ end
115154 end
116155 end
117156 end
You can’t perform that action at this time.
0 commit comments