Sfoglia il codice sorgente

test(requires): verify dependencies in vhosts

tags/v2.7.0
Javier Bértoli 3 anni fa
parent
commit
64781431b9
5 ha cambiato i file con 43 aggiunte e 0 eliminazioni
  1. +4
    -0
      kitchen.yml
  2. +11
    -0
      test/integration/default/controls/config.rb
  3. +9
    -0
      test/integration/default/controls/file.rb
  4. +13
    -0
      test/salt/default/pillar/nginx.sls
  5. +6
    -0
      test/salt/default/states/test_dep/create_dependency_file.sls

+ 4
- 0
kitchen.yml Vedi File

@@ -309,9 +309,13 @@ verifier:
suites:
- name: default
provisioner:
dependencies:
- name: test_dep
path: test/salt/default/states
state_top:
base:
'*':
- test_dep.create_dependency_file
- nginx._mapdata
- nginx
pillars:

+ 11
- 0
test/integration/default/controls/config.rb Vedi File

@@ -71,5 +71,16 @@ control 'Nginx configuration' do
its('content') { should include 'try_files $uri $uri/ =404;' }
its('content') { should include 'include snippets/letsencrypt.conf;' }
end
describe file "#{dir}/mysite_with_require" do
it { should be_file }
it { should be_owned_by file_owner }
it { should be_grouped_into file_group }
its('mode') { should cmp '0644' }
its('content') { should include 'server_name with-deps;' }
its('content') { should include 'listen 80;' }
its('content') { should include 'index index.html index.htm;' }
its('content') { should include 'location ~ .htm {' }
its('content') { should include 'try_files $uri $uri/ =404;' }
end
end
end

+ 9
- 0
test/integration/default/controls/file.rb Vedi File

@@ -0,0 +1,9 @@
# frozen_string_literal: true

control 'Dependency test file' do
title 'should exist'

describe file('/tmp/created_to_test_dependencies') do
it { should be_file }
end
end

+ 13
- 0
test/salt/default/pillar/nginx.sls Vedi File

@@ -37,6 +37,19 @@ nginx:
- location ~ .htm:
- try_files: '$uri $uri/ =404'
- include: 'snippets/letsencrypt.conf'
mysite_with_require:
enabled: true
config:
- server:
- server_name: with-deps
- listen:
- '80'
- index: 'index.html index.htm'
- location ~ .htm:
- try_files: '$uri $uri/ =404'
requires:
file: created_to_test_dependencies

dh_param:
'mydhparam2.pem':
keysize: 2048

+ 6
- 0
test/salt/default/states/test_dep/create_dependency_file.sls Vedi File

@@ -0,0 +1,6 @@
## this state creates a file that is used to test vhosts dependencies
# (see https://github.com/saltstack-formulas/nginx-formula/pull/278)

created_to_test_dependencies:
file.managed:
- name: /tmp/created_to_test_dependencies

Loading…
Annulla
Salva