From efe0cb85e2af16ffa2837914499fc3d2c33d66a4 Mon Sep 17 00:00:00 2001 From: derdanne Date: Fri, 12 Dec 2014 12:40:10 +0100 Subject: [PATCH] - added spec tests for gentoo --- spec/classes/client_gentoo_spec.rb | 25 +++++++++++++++++++++++++ spec/classes/client_spec.rb | 4 ++++ spec/classes/server_gentoo_spec.rb | 15 +++++++++++++++ spec/classes/server_spec.rb | 6 +++++- 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 spec/classes/client_gentoo_spec.rb create mode 100644 spec/classes/server_gentoo_spec.rb diff --git a/spec/classes/client_gentoo_spec.rb b/spec/classes/client_gentoo_spec.rb new file mode 100644 index 0000000..e397118 --- /dev/null +++ b/spec/classes/client_gentoo_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' +describe 'nfs::client::gentoo' do + + it do + should contain_class('nfs::client::gentoo') + should contain_class('nfs::client::gentoo::install') + should contain_class('nfs::client::gentoo::configure') + should contain_class('nfs::client::gentoo::service') + + should contain_package('net-nds/rpcbind') + should contain_package('net-fs/nfs-utils') + should contain_package('net-libs/libnfsidmap') + + + end + + context ":nfs_v4 => true" do + let(:params) {{ :nfs_v4 => true }} + it do + should contain_augeas('/etc/conf.d/nfs') + should contain_augeas('/etc/idmapd.conf') + end + end + +end diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index 3dea98b..314750c 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -21,6 +21,10 @@ let(:facts) { {:operatingsystem => 'redhat', :osmajor => 6 } } it { should contain_class('nfs::client::redhat') } end + context "operatingsysten => gentoo" do + let(:facts) { {:operatingsystem => 'gentoo', } } + it { should contain_class('nfs::client::gentoo') } + end context "operatingsystem => darwin" do let(:facts) { {:operatingsystem => 'darwin', } } it do diff --git a/spec/classes/server_gentoo_spec.rb b/spec/classes/server_gentoo_spec.rb new file mode 100644 index 0000000..633de53 --- /dev/null +++ b/spec/classes/server_gentoo_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' +describe 'nfs::server::gentoo' do + + it do + should contain_class('nfs::client::gentoo') + should contain_service('nfs').with( 'ensure' => 'running' ) + end + context ":nfs_v4 => true" do + let(:params) {{ :nfs_v4 => true , :nfs_v4_idmap_domain => 'teststring' }} + it do + should contain_augeas('/etc/idmapd.conf').with_changes(/set Domain teststring/) + end + + end +end \ No newline at end of file diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index f98c0c0..c9ffff0 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -6,7 +6,7 @@ should contain_concat__fragment('nfs_exports_header').with( 'target' => '/etc/exports' ) end context "nfs_v4 => true" do - let(:params) { {:nfs_v4 => true, } } + let(:params) { {:nfs_v4 => true, } } it do should contain_concat__fragment('nfs_exports_root').with( 'target' => '/etc/exports' ) should contain_file('/export').with( 'ensure' => 'directory' ) @@ -33,6 +33,10 @@ let(:facts) { {:operatingsystem => 'redhat', :concat_basedir => '/tmp', :osmajor => 6, } } it { should contain_class('nfs::server::redhat') } end + context "operatingsysten => gentoo" do + let(:facts) { {:operatingsystem => 'gentoo', :concat_basedir => '/tmp',} } + it { should contain_class('nfs::server::gentoo') } + end context "operatingsysten => darwin" do let(:facts) { {:operatingsystem => 'darwin'} } it do