|
170 | 170 | context 'when there is a hostname specified along with uds configuration' do |
171 | 171 | let(:with_agent_host) { 'custom-hostname' } |
172 | 172 |
|
173 | | - it 'prioritizes the http configuration' do |
174 | | - expect(resolver).to have_attributes(hostname: 'custom-hostname', adapter: :net_http) |
| 173 | + it 'prioritizes the uds configuration' do |
| 174 | + expect(resolver).to have_attributes(adapter: :unix) |
175 | 175 | end |
176 | 176 |
|
177 | | - it 'logs a warning including the uds path' do |
| 177 | + it 'logs a warning including the mismatching hostname' do |
178 | 178 | expect(logger).to receive(:warn) |
179 | | - .with(%r{Configuration mismatch.*configuration for unix domain socket \("unix:.*/some/path"\)}) |
| 179 | + .with(/Configuration mismatch:.*hostname: 'custom-hostname'.*/) |
180 | 180 |
|
181 | 181 | resolver |
182 | 182 | end |
183 | 183 |
|
184 | | - it 'does not include a uds_path in the configuration' do |
185 | | - expect(resolver).to have_attributes(uds_path: nil) |
| 184 | + it 'includes a uds_path in the configuration' do |
| 185 | + expect(resolver).to have_attributes(uds_path: '/some/path') |
186 | 186 | end |
187 | 187 |
|
188 | 188 | context 'when there is no port specified' do |
189 | | - it 'prioritizes the http configuration and uses the default port' do |
190 | | - expect(resolver).to have_attributes(port: 8126, hostname: 'custom-hostname', adapter: :net_http) |
| 189 | + it 'prioritizes the uds configuration and ignores the default port' do |
| 190 | + expect(resolver).to have_attributes(adapter: :unix) |
191 | 191 | end |
192 | 192 |
|
193 | | - it 'logs a warning including the hostname and default port' do |
| 193 | + it 'logs a warning including the uds path' do |
194 | 194 | expect(logger).to receive(:warn) |
195 | | - .with(/ |
196 | | - Configuration\ mismatch:\ values\ differ\ between\ configuration.* |
197 | | - Using\ "hostname:\ 'custom-hostname',\ port:\ '8126'".* |
198 | | - /x) |
| 195 | + .with(%r{Configuration mismatch.*Using "unix:[\/]{1,3}some/path"}) # rubocop:disable Style/edundantRegexpCharacterClass |
199 | 196 |
|
200 | 197 | resolver |
201 | 198 | end |
|
204 | 201 | context 'when there is a port specified' do |
205 | 202 | let(:with_agent_port) { 1234 } |
206 | 203 |
|
207 | | - it 'prioritizes the http configuration and uses the specified port' do |
208 | | - expect(resolver).to have_attributes(port: 1234, hostname: 'custom-hostname', adapter: :net_http) |
| 204 | + it 'prioritizes the uds path' do |
| 205 | + expect(resolver).to have_attributes(adapter: :unix) |
209 | 206 | end |
210 | 207 |
|
211 | | - it 'logs a warning including the hostname and port' do |
| 208 | + it 'logs a warning including the uds configuration' do |
212 | 209 | expect(logger).to receive(:warn) |
213 | | - .with(/ |
214 | | - Configuration\ mismatch:\ values\ differ\ between\ configuration.* |
215 | | - Using\ "hostname:\ 'custom-hostname',\ port:\ '1234'".* |
216 | | - /x) |
| 210 | + .with(%r{Configuration mismatch.*Using "unix:[\/]{1,3}some/path"}) # rubocop:disable Style/edundantRegexpCharacterClass |
217 | 211 |
|
218 | 212 | resolver |
219 | 213 | end |
220 | 214 | end |
221 | 215 | end |
222 | 216 |
|
223 | | - context 'when there is a port specified along with uds configuration' do |
| 217 | + context 'when there is a port specified along with a uds configuration' do |
224 | 218 | let(:with_agent_port) { 5678 } |
225 | 219 |
|
226 | | - it 'prioritizes the http configuration' do |
227 | | - expect(resolver).to have_attributes(port: 5678, adapter: :net_http) |
| 220 | + it 'prioritizes the uds configuration' do |
| 221 | + expect(resolver).to have_attributes(port: 5678, adapter: :unix) |
228 | 222 | end |
229 | 223 |
|
230 | | - it 'logs a warning including the uds path' do |
| 224 | + it 'logs a warning including the mismatching port' do |
231 | 225 | expect(logger).to receive(:warn) |
232 | | - .with(%r{Configuration mismatch.*configuration for unix domain socket \("unix:.*/some/path"\)}) |
| 226 | + .with(/Configuration mismatch:.*port: '5678'.*/) |
233 | 227 |
|
234 | 228 | resolver |
235 | 229 | end |
236 | 230 |
|
237 | | - it 'does not include a uds_path in the configuration' do |
238 | | - expect(resolver).to have_attributes(uds_path: nil) |
| 231 | + it 'includes the uds path in the configuration' do |
| 232 | + expect(resolver).to have_attributes(uds_path: '/some/path') |
239 | 233 | end |
240 | 234 |
|
241 | 235 | context 'when there is no hostname specified' do |
242 | | - it 'prioritizes the http configuration and uses the default hostname' do |
243 | | - expect(resolver).to have_attributes(port: 5678, hostname: '127.0.0.1', adapter: :net_http) |
| 236 | + it 'prioritizes the uds configuration' do |
| 237 | + expect(resolver).to have_attributes(port: 5678, hostname: nil, adapter: :unix) |
244 | 238 | end |
245 | 239 |
|
246 | | - it 'logs a warning including the default hostname and port' do |
| 240 | + it 'logs a warning including the uds configuration' do |
247 | 241 | expect(logger).to receive(:warn) |
248 | | - .with(/ |
249 | | - Configuration\ mismatch:\ values\ differ\ between\ configuration.* |
250 | | - Using\ "hostname:\ '127.0.0.1',\ port:\ '5678'".* |
251 | | - /x) |
| 242 | + .with(%r{Configuration mismatch.*Using "unix:[\/]{1,3}some/path"}) # rubocop:disable Style/edundantRegexpCharacterClass |
252 | 243 |
|
253 | 244 | resolver |
254 | 245 | end |
|
257 | 248 | context 'when there is a hostname specified' do |
258 | 249 | let(:with_agent_host) { 'custom-hostname' } |
259 | 250 |
|
260 | | - it 'prioritizes the http configuration and uses the specified hostname' do |
261 | | - expect(resolver).to have_attributes(port: 5678, hostname: 'custom-hostname', adapter: :net_http) |
| 251 | + it 'prioritizes the uds configuration' do |
| 252 | + expect(resolver).to have_attributes(adapter: :unix) |
262 | 253 | end |
263 | 254 |
|
264 | | - it 'logs a warning including the hostname and port' do |
| 255 | + it 'logs a warning including the uds configuration' do |
265 | 256 | expect(logger).to receive(:warn) |
266 | | - .with(/ |
267 | | - Configuration\ mismatch:\ values\ differ\ between\ configuration.* |
268 | | - Using\ "hostname:\ 'custom-hostname',\ port:\ '5678'".* |
269 | | - /x) |
| 257 | + .with(%r{Configuration mismatch.*Using "unix:[\/]{1,3}some/path"}) # rubocop:disable Style/edundantRegexpCharacterClass |
270 | 258 |
|
271 | 259 | resolver |
272 | 260 | end |
|
0 commit comments