This repository has been archived by the owner on Dec 31, 2024. It is now read-only.
forked from jhoblitt/puppet-nsstools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added rspec test infrastructure, travis-ci, fixed typo
- Loading branch information
Showing
8 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fixtures: | ||
symlinks: | ||
nssdb: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: ruby | ||
rvm: | ||
- 1.8.7 | ||
- 1.9.3 | ||
- 2.0.0 | ||
- ruby-head | ||
script: "rake all" | ||
branches: | ||
only: | ||
- rspec_infrastructure | ||
env: | ||
- PUPPET_GEM_VERSION="~> 2.7" | ||
- PUPPET_GEM_VERSION="~> 3.3" | ||
matrix: | ||
allow_failures: | ||
- rvm: ruby-head | ||
notifications: | ||
email: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source :rubygems | ||
|
||
group :development, :test do | ||
gem 'puppetlabs_spec_helper', :require => false | ||
end | ||
|
||
if puppetversion = ENV['PUPPET_GEM_VERSION'] | ||
gem 'puppet', puppetversion, :require => false | ||
else | ||
gem 'puppet', :require => false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'rubygems' | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'rake/clean' | ||
|
||
CLEAN.include('spec/fixtures/', 'spec/reports') | ||
|
||
task :spec => [:spec_prep] | ||
|
||
desc "Run all tasks (spec)" | ||
task :all => [ :spec ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
describe 'nssdb::add_cert_and_key', :type => :define do | ||
let(:title) { 'qpidd' } | ||
let(:params) do { | ||
:nickname => 'Server-Cert', | ||
:cert => '/tmp/server.cert', | ||
:key => '/tmp/server.key', | ||
:basedir => '/obsolete' | ||
} | ||
end | ||
|
||
context 'generate_pkcs12' do | ||
it{ should contain_exec('generate_pkcs12').with( | ||
:command => %r{-in /tmp/server.cert -inkey /tmp/server.key.*file:/obsolete/qpidd.*out \'/obsolete/qpidd/qpidd.p12\' -name Server-Cert}, | ||
:require => [ 'File[/obsolete/qpidd/password.conf]', | ||
'File[/obsolete/qpidd/cert8.db]', | ||
'Package[openssl]' ], | ||
:subscribe => 'File[/obsolete/qpidd/password.conf]' | ||
)} | ||
end | ||
|
||
context 'load_pkcs12' do | ||
it{ should contain_exec('load_pkcs12').with( | ||
:command => %r{-i \'/obsolete/qpidd/qpidd.p12\' -d \'/obsolete/qpidd\' -w \'/obsolete/qpidd.*-k \'/obsolete/qpidd} | ||
)} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
require 'spec_helper' | ||
|
||
describe 'nssdb::create', :type => :define do | ||
let(:title) { 'test' } | ||
let(:params) do { | ||
:owner_id => 'nobody', | ||
:group_id => 'nobody', | ||
:password => 'secret', | ||
:basedir => '/obsolete', | ||
:cacert => '/ca.crt', | ||
:canickname => 'ca', | ||
:catrust => 'CTu' | ||
} | ||
end | ||
|
||
context 'nssdb directory' do | ||
it{ should contain_file('/obsolete/test').with( | ||
:owner => 'nobody', | ||
:group => 'nobody' | ||
)} | ||
end | ||
|
||
context 'password file' do | ||
it{ should contain_file('/obsolete/test/password.conf').with( | ||
:owner => 'nobody', | ||
:group => 'nobody', | ||
:content => 'secret', | ||
:require => 'File[/obsolete/test]' | ||
)} | ||
end | ||
|
||
context 'database files' do | ||
databases = ['cert8.db', 'key3.db', 'secmod.db'] | ||
databases.each do |db| | ||
it{ should contain_file('/obsolete/test/' + db).with( | ||
:owner => 'nobody', | ||
:group => 'nobody', | ||
:require => [ 'File[/obsolete/test/password.conf]', 'Exec[create_nss_db]'] | ||
)} | ||
end | ||
end | ||
|
||
context 'create nss db' do | ||
it{ should contain_exec('create_nss_db').with( | ||
:command => %r{-d /obsolete/test -f /obsolete/test}, | ||
:creates => [ '/obsolete/test/cert8.db', '/obsolete/test/key3.db', '/obsolete/test/secmod.db'], | ||
:require => [ 'File[/obsolete/test]', | ||
'File[/obsolete/test/password.conf]', | ||
'Package[nss-tools]' ] | ||
)} | ||
end | ||
|
||
context 'add ca cert' do | ||
it{ should contain_exec('add_ca_cert').with( | ||
:command => %r{-n ca -d /obsolete/test -t CTu.*-i /ca.crt}, | ||
:onlyif => %r{-e /ca.crt} | ||
)} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'rubygems' | ||
require 'puppetlabs_spec_helper/module_spec_helper' |