should contain_file('org.apache.karaf.features.cfg').with(
'ensure' => 'file',
'path' => '/opt/opendaylight/etc/org.apache.karaf.features.cfg',
+ 'owner' => 'odl',
+ 'group' => 'odl',
)
}
end
# Shared tests that specialize in testing Karaf feature installs
-def karaf_feature_tests(features)
+def karaf_feature_tests(options = {})
+ # Extract params
+ # NB: This default list should be the same as the one in opendaylight::params
+ # TODO: Remove this possible source of bugs^^
+ default_features = options.fetch(:default_features, ['config', 'standard', 'region', 'package', 'kar', 'ssh', 'management'])
+ extra_features = options.fetch(:extra_features, [])
+
+ # The order of this list concat matters
+ features = default_features + extra_features
+
# Confirm properties of other resources
# NB: These hashes don't work with Ruby 1.8.7, but we
# don't support 1.8.7 so that's okay. See issue #36.
should contain_file('org.apache.karaf.features.cfg').with(
'ensure' => 'file',
'path' => '/opt/opendaylight/etc/org.apache.karaf.features.cfg',
+ 'owner' => 'odl',
+ 'group' => 'odl',
'content' => /^featuresBoot=#{features.join(",")}/
)
}
# Validations specific to Debain family OSs (Ubuntu)
it {
should contain_package('java').with(
- 'name' => 'java7-jdk',
+ 'name' => 'openjdk-7-jdk',
)
}
it {
'mode' => '0644',
)
}
+ expected_msg = 'Debian has limited support, is less stable, less tested.'
+ it {
+ expect {
+ # This could be any check, most (all?) will raise warning
+ should contain_file('/etc/init/opendaylight.conf').to(
+ raise_warning(Puppet::Warning, /#{expected_msg}/)
+ )
+ }
+ }
else
fail("Unexpected osfamily #{osfamily}")
end
def rpm_install_tests(options = {})
# Extract params
+ # Choose Yum URL based on OS (CentOS vs Fedora)
+ operatingsystem = options.fetch(:operatingsystem, 'CentOS')
+ case operatingsystem
+ when 'CentOS'
+ yum_repo = 'https://copr-be.cloud.fedoraproject.org/results/dfarrell07/OpenDaylight/epel-7-$basearch/'
+ when 'Fedora'
+ yum_repo = 'https://copr-be.cloud.fedoraproject.org/results/dfarrell07/OpenDaylight/fedora-$releasever-$basearch/'
+ else
+ fail("Unknown operatingsystem: #{operatingsystem}")
+ end
+
# Default to CentOS 7 Yum repo URL
- yum_repo = options.fetch(:yum_repo, 'https://copr-be.cloud.fedoraproject.org/results/dfarrell07/OpenDaylight/epel-7-$basearch/')
# Confirm presence of RPM-related resources
it { should contain_yumrepo('opendaylight') }
end
# Shared tests for unsupported OSs
-def unsupported_os_tests(expected_err_msg)
+def unsupported_os_tests(options = {})
+ # Extract params
+ expected_msg = options.fetch(:expected_msg)
+
# Confirm that classes fail on unsupported OSs
- it { expect { should contain_class('opendaylight') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
- it { expect { should contain_class('opendaylight::install') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
- it { expect { should contain_class('opendaylight::config') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
- it { expect { should contain_class('opendaylight::service') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
+ it { expect { should contain_class('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+ it { expect { should contain_class('opendaylight::install') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+ it { expect { should contain_class('opendaylight::config') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+ it { expect { should contain_class('opendaylight::service') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
# Confirm that other resources fail on unsupported OSs
- it { expect { should contain_yumrepo('opendaylight') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
- it { expect { should contain_package('opendaylight') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
- it { expect { should contain_service('opendaylight') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
- it { expect { should contain_file('org.apache.karaf.features.cfg') }.to raise_error(Puppet::Error, /#{expected_err_msg}/) }
+ it { expect { should contain_yumrepo('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+ it { expect { should contain_package('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+ it { expect { should contain_service('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+ it { expect { should contain_file('org.apache.karaf.features.cfg') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
end