Adds unit tests for midonet::cluster::*

Change-Id: Id6119ac7e0984a46e0712614a28a4acddc1964d3
This commit is contained in:
Alejandro Andreu
2016-07-18 15:14:04 +02:00
parent 6f8945c1c0
commit 9819f7ad1c
4 changed files with 76 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ class midonet::cluster::install (
include midonet::repository
package {'midonet-cluster':
package { 'midonet-cluster':
ensure => present,
name => $package_name,
}

View File

@@ -0,0 +1,18 @@
require 'spec_helper'
describe 'midonet::cluster::install' do
context 'with parameters' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistrelease => '16.04',
}
end
it { is_expected.to contain_class('midonet::repository') }
it { is_expected.to contain_package('midonet-cluster').with(
'ensure' => 'present',
'name' => 'midonet-cluster',
) }
end
end

View File

@@ -0,0 +1,33 @@
require 'spec_helper'
describe 'midonet::cluster::run' do
context 'with parameters' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistrelease => '16.04',
}
end
let :params do
{
:zookeeper_hosts => ['{ "ip" => "127.0.0.1", "port" => "2181" }'],
:cassandra_servers => [ '127.0.0.1' ],
:cassandra_rep_factor => '3',
:keystone_admin_token => 'ADMIN_TOKEN',
:keystone_host => '127.0.0.1',
}
end
it { is_expected.to contain_exec('/bin/bash /tmp/mn-cluster_config.sh') }
it { is_expected.to contain_file('/tmp/mn-cluster_config.sh').with_ensure('present') }
it { is_expected.to contain_file('cluster_config').with(
'ensure' => 'present',
'path' => '/etc/midonet/midonet.conf',
) }
it { is_expected.to contain_service('midonet-cluster').with(
'ensure' => 'running',
'enable' => 'true',
'name' => 'midonet-cluster'
) }
end
end

View File

@@ -0,0 +1,24 @@
require 'spec_helper'
describe 'midonet::cluster' do
context 'with parameters' do
let :facts do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistrelease => '16.04',
}
end
let :params do
{
:zookeeper_hosts => ['{ "ip" => "127.0.0.1", "port" => "2181" }'],
:cassandra_servers => [ '127.0.0.1' ],
:cassandra_rep_factor => '3',
:keystone_admin_token => 'ADMIN_TOKEN',
:keystone_host => '127.0.0.1',
}
end
it { is_expected.to contain_class('midonet::cluster::install') }
it { is_expected.to contain_class('midonet::cluster::run') }
end
end