Skip to content

Commit

Permalink
test: add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
genaumann committed Jan 20, 2024
1 parent 3778f49 commit 64dc334
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ suites:
provisioner:
state_top:
base:
"*": []
pillars_from_files: {}
"*":
- acme_sh
pillars_from_files:
acme_sh.sls: test/salt/pillar/acme_sh.sls
pillars:
top.sls:
base:
"*": []
"*":
- acme_sh
verifier:
inspec_tests:
- path: test/integration/default
Expand All @@ -45,6 +48,7 @@ provisioner:
salt_install: none
require_chef: false
formula: acme_sh
pre_salt_command: <%= ENV['CRED'] %>
salt_copy_filter:
- .git/
- .github/
Expand Down
14 changes: 14 additions & 0 deletions test/integration/default/controls/cert.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

control "Cert x509 #{os.name}" do
title 'Test x509 cert files'

dir = '/home/vagrant/crt/acmeshtest.gn98.de'

describe x509_certificate("#{dir}/fullchain.cer") do
it { should be_certificate }
its('key_length') { should be 4096 }
its('subject.CN') { should eq 'acmeshtest.gn98.de' }
its('validity_in_days') { should be > 30 }
end
end
19 changes: 19 additions & 0 deletions test/integration/default/controls/file.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

control "Cert files #{os.name}" do
title 'Test cert files'

dir = '/home/vagrant/crt/acmeshtest.gn98.de'

describe directory(dir) do
it { should exist }
end

describe file("#{dir}/fullchain.cer") do
it { should exist }
end

describe file("#{dir}/acmeshtest.gn98.de.key") do
it { should exist }
end
end

0 comments on commit 64dc334

Please sign in to comment.