From 4ed788e5c78f377325630a7af40464d6d3f8e8dd Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Fri, 26 Apr 2019 16:11:51 +0100 Subject: [PATCH] test(inspec): add test for `log_format` #219 --- test/integration/default/controls/config.rb | 3 +++ test/salt/default/pillar/nginx.sls | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/test/integration/default/controls/config.rb b/test/integration/default/controls/config.rb index 8a32ac6..fb7d69c 100644 --- a/test/integration/default/controls/config.rb +++ b/test/integration/default/controls/config.rb @@ -22,6 +22,9 @@ control 'Nginx configuration' do it { should be_owned_by 'root' } it { should be_grouped_into 'root' } its('mode') { should cmp '0644' } + its('content') { should include %Q[ log_format main '$remote_addr - $remote_user [$time_local] $status ' + '"$request" $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"';] } end # snippets configuration diff --git a/test/salt/default/pillar/nginx.sls b/test/salt/default/pillar/nginx.sls index feb6581..274895c 100644 --- a/test/salt/default/pillar/nginx.sls +++ b/test/salt/default/pillar/nginx.sls @@ -10,6 +10,14 @@ nginx: letsencrypt: - location ^~ /.well-known/acme-challenge/: - proxy_pass: http://localhost:9999 + server: + config: + http: + ### module ngx_http_log_module example + log_format: |- + main '$remote_addr - $remote_user [$time_local] $status ' + '"$request" $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"' servers: managed: default: