Add configuration purge functional test
The patch adds an additional test that verifies the providers purge support is working. Change-Id: I863ef131fb859788d446d2199a0ef6eafd8f21f4
This commit is contained in:
@@ -2,9 +2,28 @@ require 'spec_helper_acceptance'
|
|||||||
|
|
||||||
describe 'basic neutron_config resource' do
|
describe 'basic neutron_config resource' do
|
||||||
|
|
||||||
context 'default parameters' do
|
neutron_files = [ '/etc/neutron/api-paste.ini',
|
||||||
|
'/etc/neutron/neutron.conf',
|
||||||
|
'/etc/neutron/dhcp_agent.ini',
|
||||||
|
'/etc/neutron/fwaas_driver.ini',
|
||||||
|
'/etc/neutron/l3_agent.ini',
|
||||||
|
'/etc/neutron/lbaas_agent.ini',
|
||||||
|
'/etc/neutron/metadata_agent.ini',
|
||||||
|
'/etc/neutron/metering_agent.ini',
|
||||||
|
'/etc/neutron/plugins/cisco/cisco_plugins.ini',
|
||||||
|
'/etc/neutron/plugins/cisco/credentials.ini',
|
||||||
|
'/etc/neutron/plugins/cisco/db_conn.ini',
|
||||||
|
'/etc/neutron/plugins/cisco/l2network_plugin.ini',
|
||||||
|
'/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini',
|
||||||
|
'/etc/neutron/plugins/ml2/ml2_conf.ini',
|
||||||
|
'/etc/neutron/plugins/nicira/nvp.ini',
|
||||||
|
'/etc/neutron/vpn_agent.ini',
|
||||||
|
'/etc/neutron/plugins/midonet/midonet.ini',
|
||||||
|
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
|
||||||
|
'/etc/neutron/plugins/plumgrid/plumgrid.ini',
|
||||||
|
'/etc/neutron/plugins/ml2/ml2_conf_sriov.ini',
|
||||||
|
'/etc/neutron/plugins/ml2/sriov_agent.ini']
|
||||||
|
|
||||||
it 'should work with no errors' do
|
|
||||||
pp= <<-EOS
|
pp= <<-EOS
|
||||||
Exec { logoutput => 'on_failure' }
|
Exec { logoutput => 'on_failure' }
|
||||||
|
|
||||||
@@ -72,7 +91,6 @@ describe 'basic neutron_config resource' do
|
|||||||
file { $neutron_files :
|
file { $neutron_files :
|
||||||
ensure => file,
|
ensure => file,
|
||||||
}
|
}
|
||||||
|
|
||||||
neutron_api_config { 'DEFAULT/thisshouldexist' :
|
neutron_api_config { 'DEFAULT/thisshouldexist' :
|
||||||
value => 'foo',
|
value => 'foo',
|
||||||
}
|
}
|
||||||
@@ -506,35 +524,55 @@ describe 'basic neutron_config resource' do
|
|||||||
|
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
resource_names = ['neutron_api_config',
|
||||||
|
'neutron_config',
|
||||||
|
'neutron_dhcp_agent_config',
|
||||||
|
'neutron_fwaas_service_config',
|
||||||
|
'neutron_l3_agent_config',
|
||||||
|
'neutron_lbaas_agent_config',
|
||||||
|
'neutron_metadata_agent_config',
|
||||||
|
'neutron_plugin_cisco',
|
||||||
|
'neutron_plugin_cisco_credentials',
|
||||||
|
'neutron_plugin_cisco_db_conn',
|
||||||
|
'neutron_plugin_cisco_l2network',
|
||||||
|
'neutron_plugin_linuxbridge',
|
||||||
|
'neutron_metering_agent_config',
|
||||||
|
'neutron_plugin_ml2',
|
||||||
|
'neutron_plugin_nvp',
|
||||||
|
'neutron_vpnaas_agent_config',
|
||||||
|
'neutron_plugin_midonet',
|
||||||
|
'neutron_plugin_opencontrail',
|
||||||
|
'neutron_agent_linuxbridge',
|
||||||
|
'neutron_agent_ovs',
|
||||||
|
'neutron_plugin_plumgrid',
|
||||||
|
'neutron_plugin_sriov',
|
||||||
|
'neutron_sriov_agent_config']
|
||||||
|
|
||||||
|
pp_resource_names = " $resource_names = [" + resource_names.collect { |r| " '#{r}'," }.join("\n") + " ]\n"
|
||||||
|
|
||||||
|
pp_purge = pp + pp_resource_names + <<-EOS
|
||||||
|
|
||||||
|
resources { $resource_names:
|
||||||
|
purge => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
EOS
|
||||||
|
|
||||||
|
bogus_config = <<-EOS
|
||||||
|
$junk = {'DEFAULT/xyz_unsupported_value_123' => { value => false },
|
||||||
|
'DEFAULT/xyz_unsupported_value_569' => { value => 'some_string' }
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
|
||||||
|
pp_bogus_config = bogus_config + resource_names.collect { |r| " create_resources('#{r}', $junk)" }.join("\n")
|
||||||
|
|
||||||
|
context 'with default parameters' do
|
||||||
# Run it twice and test for idempotency
|
# Run it twice and test for idempotency
|
||||||
|
before :all do
|
||||||
apply_manifest(pp, :catch_failures => true)
|
apply_manifest(pp, :catch_failures => true)
|
||||||
apply_manifest(pp, :catch_changes => true)
|
apply_manifest(pp, :catch_changes => true)
|
||||||
end
|
end
|
||||||
|
neutron_files.each do |neutron_conf_file|
|
||||||
$neutron_files = [ '/etc/neutron/api-paste.ini',
|
|
||||||
'/etc/neutron/neutron.conf',
|
|
||||||
'/etc/neutron/dhcp_agent.ini',
|
|
||||||
'/etc/neutron/fwaas_driver.ini',
|
|
||||||
'/etc/neutron/l3_agent.ini',
|
|
||||||
'/etc/neutron/lbaas_agent.ini',
|
|
||||||
'/etc/neutron/metadata_agent.ini',
|
|
||||||
'/etc/neutron/metering_agent.ini',
|
|
||||||
'/etc/neutron/plugins/cisco/cisco_plugins.ini',
|
|
||||||
'/etc/neutron/plugins/cisco/credentials.ini',
|
|
||||||
'/etc/neutron/plugins/cisco/db_conn.ini',
|
|
||||||
'/etc/neutron/plugins/cisco/l2network_plugin.ini',
|
|
||||||
'/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini',
|
|
||||||
'/etc/neutron/plugins/ml2/ml2_conf.ini',
|
|
||||||
'/etc/neutron/plugins/nicira/nvp.ini',
|
|
||||||
'/etc/neutron/vpn_agent.ini',
|
|
||||||
'/etc/neutron/plugins/midonet/midonet.ini',
|
|
||||||
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
|
|
||||||
'/etc/neutron/plugins/plumgrid/plumgrid.ini',
|
|
||||||
'/etc/neutron/plugins/ml2/ml2_conf_sriov.ini',
|
|
||||||
'/etc/neutron/plugins/ml2/sriov_agent.ini']
|
|
||||||
|
|
||||||
$neutron_files.each do |neutron_conf_file|
|
|
||||||
describe file(neutron_conf_file) do
|
describe file(neutron_conf_file) do
|
||||||
it { is_expected.to exist }
|
it { is_expected.to exist }
|
||||||
it { is_expected.to contain('thisshouldexist=foo') }
|
it { is_expected.to contain('thisshouldexist=foo') }
|
||||||
@@ -547,4 +585,26 @@ describe 'basic neutron_config resource' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'purge unmanaged resources' do
|
||||||
|
before :all do
|
||||||
|
apply_manifest(pp_bogus_config, :catch_failures => true)
|
||||||
|
apply_manifest(pp_purge, :catch_failures => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
neutron_files.each do |neutron_conf_file|
|
||||||
|
describe file(neutron_conf_file) do
|
||||||
|
it { is_expected.to exist }
|
||||||
|
it { is_expected.to contain('thisshouldexist=foo') }
|
||||||
|
it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
|
||||||
|
|
||||||
|
describe '#content' do
|
||||||
|
subject { super().content }
|
||||||
|
it { is_expected.to_not match /thisshouldnotexist/ }
|
||||||
|
it { is_expected.to_not match /xyz_unsupported_value/ }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user