Skip to content

Commit

Permalink
test: add more domains to test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
genaumann committed Jan 23, 2024
1 parent 26d45dc commit c471522
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
24 changes: 18 additions & 6 deletions test/integration/default/controls/cert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@
control "Cert x509 #{os.name}" do
title 'Test x509 cert files'

dir = '/home/vagrant/crt/acmeshtest.gn98.de'
crts = {
'standalone.gn98.de' => {
'alias' => 'www.standalone.gn98.de',
'keylength' => 2048,
},
'alpn.gn98.de' => {
'keylength' => 4096,
}
}
crts.each do |cn, conf|
dir = "/home/vagrant/crt/#{cn}"

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 }
describe x509_certificate("#{dir}/fullchain.cer") do
it { should be_certificate }
its('subject.CN') { should eq cn }
its('keylength') { should eq conf['keylength'] }
its('subject_alt_names') { should include "DNS:#{conf['alias']}" } if conf['alias']
its('validity_in_days') { should be > 30 }
end
end
end
24 changes: 14 additions & 10 deletions test/integration/default/controls/file.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# frozen_string_literal: true

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

dir = '/home/vagrant/crt/acmeshtest.gn98.de'
crts = ['standalone.gn98.de', 'alpn.gn98.de']

crts.each do |crt|
dir = "/home/vagrant/crt/#{crt}"

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

describe file("#{dir}/fullchain.cer") 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 }
describe file("#{dir}/#{crt}.key") do
it { should exist }
end
end
end

0 comments on commit c471522

Please sign in to comment.