diff options
Diffstat (limited to 'spec/defines')
-rw-r--r-- | spec/defines/openvpn_client_spec.rb | 105 | ||||
-rw-r--r-- | spec/defines/openvpn_server_spec.rb | 13 |
2 files changed, 15 insertions, 103 deletions
diff --git a/spec/defines/openvpn_client_spec.rb b/spec/defines/openvpn_client_spec.rb index 143b76f..a4b580e 100644 --- a/spec/defines/openvpn_client_spec.rb +++ b/spec/defines/openvpn_client_spec.rb @@ -4,6 +4,15 @@ describe 'openvpn::client', :type => :define do let(:title) { 'test_client' } let(:params) { { 'server' => 'test_server' } } let(:facts) { { :fqdn => 'somehost', :concat_basedir => '/var/lib/puppet/concat' } } + let(:pre_condition) do + 'openvpn::server { "test_server": + country => "CO", + province => "ST", + city => "Some City", + organization => "example.org", + email => "testemail@example.org" + }' + end it { should contain_exec('generate certificate for test_client in context of test_server') } @@ -53,7 +62,6 @@ describe 'openvpn::client', :type => :define do 'mute' => 10, 'mute_replay_warnings' => false, 'nobind' => false, - 'ns_cert_type' => 'client', 'persist_key' => false, 'persist_tun' => false, 'port' => '123', @@ -73,103 +81,8 @@ describe 'openvpn::client', :type => :define do it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^remote\s+somewhere\s+123$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^comp-something$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^resolv-retry\s+2m$/)} - it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^ns\-cert\-type\s+client$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^verb\s+1$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^mute\s+10$/)} end - - - - -# it { should contain_openvpn__option('ca test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'ca', -# 'value' => 'keys/ca.crt' -# )} -# it { should contain_openvpn__option('cert test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'cert', -# 'value' => 'keys/test_client.crt' -# )} -# it { should contain_openvpn__option('key test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'key', -# 'value' => 'keys/test_client.key' -# )} -# it { should contain_openvpn__option('client test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'client' -# )} -# it { should contain_openvpn__option('dev test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'dev', -# 'value' => 'tun' -# )} -# it { should contain_openvpn__option('proto test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'proto', -# 'value' => 'tcp' -# )} -# it { should contain_openvpn__option('remote test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'remote', -# 'value' => 'somehost 1194' -# )} -# it { should contain_openvpn__option('resolv-retry test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'resolv-retry', -# 'value' => 'infinite' -# )} -# it { should contain_openvpn__option('nobind test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'nobind' -# )} -# it { should contain_openvpn__option('persist-key test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'persist-key' -# )} -# it { should contain_openvpn__option('persist-tun test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'persist-tun' -# )} -# it { should contain_openvpn__option('mute-replay-warnings test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'mute-replay-warnings' -# )} -# it { should contain_openvpn__option('ns-cert-type test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'ns-cert-type', -# 'value' => 'server' -# )} -# it { should contain_openvpn__option('comp-lzo test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'comp-lzo' -# )} -# it { should contain_openvpn__option('verb test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'verb', -# 'value' => '3' -# )} -# it { should contain_openvpn__option('mute test_server with test_client').with( -# 'server' => 'test_server', -# 'client' => 'test_client', -# 'key' => 'mute', -# 'value' => '20' -# )} end diff --git a/spec/defines/openvpn_server_spec.rb b/spec/defines/openvpn_server_spec.rb index 85dadf2..b48c738 100644 --- a/spec/defines/openvpn_server_spec.rb +++ b/spec/defines/openvpn_server_spec.rb @@ -38,12 +38,6 @@ describe 'openvpn::server', :type => :define do it { should contain_exec('generate dh param test_server') } it { should contain_exec('initca test_server') } it { should contain_exec('generate server cert test_server') } - - # Configure to start vpn session - it { should contain_concat__fragment('openvpn.default.autostart.test_server').with( - 'content' => "AUTOSTART=\"$AUTOSTART test_server\"\n", - 'target' => '/etc/default/openvpn' - )} # VPN server config file itself it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^mode\s+server$/) } @@ -61,7 +55,6 @@ describe 'openvpn::server', :type => :define do it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^status\s+test_server\/openvpn\-status\.log$/) } it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^dev\s+tun0$/) } it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^local\s+1\.2\.3\.4$/) } - it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^server\s+1\.2\.3\.0\s+255\.255\.255\.0$/) } end context "creating a server setting all parameters" do @@ -153,6 +146,12 @@ describe 'openvpn::server', :type => :define do it { should contain_exec('copy easy-rsa to openvpn config folder test_server').with( 'command' => '/bin/cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/test_server/easy-rsa' )} + + # Configure to start vpn session + it { should contain_concat__fragment('openvpn.default.autostart.test_server').with( + 'content' => "AUTOSTART=\"$AUTOSTART test_server\"\n", + 'target' => '/etc/default/openvpn' + )} end |