|
236 | 236 | attr: 'reset_timedout_connection', |
237 | 237 | value: 'on', |
238 | 238 | match: %r{^\s+reset_timedout_connection\s+on;} |
| 239 | + }, |
| 240 | + { |
| 241 | + title: 'access_log undef', |
| 242 | + attr: 'access_log', |
| 243 | + value: :undef, |
| 244 | + notmatch: %r{\s+access_log\s+.+;} |
| 245 | + }, |
| 246 | + { |
| 247 | + title: 'disabling access_log ', |
| 248 | + attr: 'access_log', |
| 249 | + value: 'off', |
| 250 | + match: %r{\s+access_log\s+off;} |
| 251 | + }, |
| 252 | + { |
| 253 | + title: 'override access_log ', |
| 254 | + attr: 'access_log', |
| 255 | + value: '/var/log/nginx/specific-location.log', |
| 256 | + match: %r{\s+access_log\s+/var/log/nginx/specific-location\.log;} |
| 257 | + }, |
| 258 | + { |
| 259 | + title: 'override access_log with an array', |
| 260 | + attr: 'access_log', |
| 261 | + value: [ |
| 262 | + '/var/log/nginx/specific-location.log', |
| 263 | + 'syslog:server=10.0.0.1' |
| 264 | + ], |
| 265 | + match: [ |
| 266 | + %r{\s+access_log\s+/var/log/nginx/specific-location\.log;}, |
| 267 | + %r{\s+access_log\s+syslog:server=10\.0\.0\.1\s*;} |
| 268 | + ] |
| 269 | + }, |
| 270 | + { |
| 271 | + title: 'enabling logging errors not found', |
| 272 | + attr: 'log_not_found', |
| 273 | + value: 'off', |
| 274 | + match: %r{\s+log_not_found\s+off;} |
| 275 | + }, |
| 276 | + { |
| 277 | + title: 'enabling logging errors not found', |
| 278 | + attr: 'log_not_found', |
| 279 | + value: 'on', |
| 280 | + match: %r{\s+log_not_found\s+on;} |
| 281 | + }, |
| 282 | + { |
| 283 | + title: 'should set error_log', |
| 284 | + attr: 'error_log', |
| 285 | + value: '/path/to/error.log', |
| 286 | + match: ' error_log /path/to/error.log;' |
| 287 | + }, |
| 288 | + { |
| 289 | + title: 'should allow multiple error_log directives', |
| 290 | + attr: 'error_log', |
| 291 | + value: ['/path/to/error.log', 'syslog:server=localhost'], |
| 292 | + match: [ |
| 293 | + ' error_log /path/to/error.log;', |
| 294 | + ' error_log syslog:server=localhost;' |
| 295 | + ] |
| 296 | + }, |
| 297 | + { |
| 298 | + title: 'should not include error_log in server when set to absent', |
| 299 | + attr: 'error_log', |
| 300 | + value: 'absent', |
| 301 | + notmatch: 'error_log' |
239 | 302 | } |
240 | 303 | ].each do |param| |
241 | 304 | context "when #{param[:attr]} is #{param[:value]}" do |
|
1002 | 1065 | attr: 'proxy_busy_buffers_size', |
1003 | 1066 | value: '16k', |
1004 | 1067 | match: %r{\s+proxy_busy_buffers_size\s+16k;} |
1005 | | - }, |
1006 | | - { |
1007 | | - title: 'access_log undef', |
1008 | | - attr: 'access_log', |
1009 | | - value: :undef, |
1010 | | - notmatch: %r{\s+access_log\s+.+;} |
1011 | | - }, |
1012 | | - { |
1013 | | - title: 'disabling access_log ', |
1014 | | - attr: 'access_log', |
1015 | | - value: 'off', |
1016 | | - match: %r{\s+access_log\s+off;} |
1017 | | - }, |
1018 | | - { |
1019 | | - title: 'override access_log ', |
1020 | | - attr: 'access_log', |
1021 | | - value: '/var/log/nginx/specific-location.log', |
1022 | | - match: %r{\s+access_log\s+/var/log/nginx/specific-location\.log;} |
1023 | | - }, |
1024 | | - { |
1025 | | - title: 'override access_log with an array', |
1026 | | - attr: 'access_log', |
1027 | | - value: [ |
1028 | | - '/var/log/nginx/specific-location.log', |
1029 | | - 'syslog:server=10.0.0.1' |
1030 | | - ], |
1031 | | - match: [ |
1032 | | - %r{\s+access_log\s+/var/log/nginx/specific-location\.log;}, |
1033 | | - %r{\s+access_log\s+syslog:server=10\.0\.0\.1\s*;} |
1034 | | - ] |
1035 | | - }, |
1036 | | - { |
1037 | | - title: 'enabling logging errors not found', |
1038 | | - attr: 'log_not_found', |
1039 | | - value: 'off', |
1040 | | - match: %r{\s+log_not_found\s+off;} |
1041 | | - }, |
1042 | | - { |
1043 | | - title: 'enabling logging errors not found', |
1044 | | - attr: 'log_not_found', |
1045 | | - value: 'on', |
1046 | | - match: %r{\s+log_not_found\s+on;} |
1047 | | - }, |
1048 | | - { |
1049 | | - title: 'should set error_log', |
1050 | | - attr: 'error_log', |
1051 | | - value: '/path/to/error.log', |
1052 | | - match: ' error_log /path/to/error.log;' |
1053 | | - }, |
1054 | | - { |
1055 | | - title: 'should allow multiple error_log directives', |
1056 | | - attr: 'error_log', |
1057 | | - value: ['/path/to/error.log', 'syslog:server=localhost'], |
1058 | | - match: [ |
1059 | | - ' error_log /path/to/error.log;', |
1060 | | - ' error_log syslog:server=localhost;' |
1061 | | - ] |
1062 | | - }, |
1063 | | - { |
1064 | | - title: 'should not include error_log in server when set to absent', |
1065 | | - attr: 'error_log', |
1066 | | - value: 'absent', |
1067 | | - notmatch: 'error_log' |
1068 | | - }, |
| 1068 | + } |
1069 | 1069 | ].each do |param| |
1070 | 1070 | context "when #{param[:attr]} is #{param[:value]}" do |
1071 | 1071 | let(:default_params) { { location: 'location', proxy: 'proxy_value', server: 'server1' } } |
|
0 commit comments