Adds unit tests for midonet::cluster::*
Change-Id: Id6119ac7e0984a46e0712614a28a4acddc1964d3
This commit is contained in:
@@ -28,7 +28,7 @@ class midonet::cluster::install (
|
||||
|
||||
include midonet::repository
|
||||
|
||||
package {'midonet-cluster':
|
||||
package { 'midonet-cluster':
|
||||
ensure => present,
|
||||
name => $package_name,
|
||||
}
|
||||
|
||||
18
spec/classes/midonet_cluster_install_spec.rb
Normal file
18
spec/classes/midonet_cluster_install_spec.rb
Normal 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
|
||||
33
spec/classes/midonet_cluster_run_spec.rb
Normal file
33
spec/classes/midonet_cluster_run_spec.rb
Normal 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
|
||||
24
spec/classes/midonet_cluster_spec.rb
Normal file
24
spec/classes/midonet_cluster_spec.rb
Normal 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
|
||||
Reference in New Issue
Block a user