# NB: These are a library of helper fns used by the Beaker tests
#
+# NB: There are a large number of helper functions used in these tests.
+# They make this code much more friendly, but may need to be referenced.
+# The serverspec helpers (`should`, `be_running`...) are documented here:
+# http://serverspec.org/resource_types.html
+
def install_odl(options = {})
# NB: These param defaults should match the ones used by the opendaylight
# class, which are defined in opendaylight::params
# TODO: Remove this possible source of bugs^^
# Extract params if given, defaulting to odl class defaults if not
- install_method = options.fetch(:install_method, 'rpm')
+ # Default install method is passed via environment var, set in Rakefile
+ install_method = options.fetch(:install_method, ENV['INSTALL_METHOD'])
extra_features = options.fetch(:extra_features, [])
default_features = options.fetch(:default_features, ['config', 'standard', 'region',
'package', 'kar', 'ssh', 'management'])
# Apply our Puppet manifest on the Beaker host
apply_manifest(pp, :catch_failures => true)
- # Run it twice to test for idempotency
- apply_manifest(pp, :catch_changes => true)
+
+ # The tarball extract isn't idempotent, can't do this check
+ # See: https://github.com/dfarrell07/puppet-opendaylight/issues/45#issuecomment-78135725
+ if install_method != 'tarball'
+ # Run it twice to test for idempotency
+ apply_manifest(pp, :catch_changes => true)
+ end
end
end
it { should be_directory }
it { should be_owned_by 'odl' }
it { should be_grouped_into 'odl' }
- it { should be_mode '775' }
+ end
+
+ # Verify ODL systemd .service file
+ describe file('/usr/lib/systemd/system/opendaylight.service') do
+ it { should be_file }
+ it { should be_owned_by 'root' }
+ it { should be_grouped_into 'root' }
+ it { should be_mode '644' }
end
# Verify ODL's systemd service
it { should be_running }
end
- # OpenDaylight will appear as a Java process
- describe process('java') do
- it { should be_running }
- end
-
# Creation handled by RPM, or Puppet during tarball installs
# TODO: It'd be nice to do this independently of install dir name
describe user('odl') do
it { should have_home_directory '/opt/opendaylight-0.2.2' }
end
+ # Creation handled by RPM, or Puppet during tarball installs
+ describe group('odl') do
+ it { should exist }
+ end
+
# This should not be the odl user's home dir
describe file('/home/odl') do
# Home dir shouldn't be created for odl user
it { should_not be_directory }
end
- # Verify ODL systemd .service file
- describe file('/usr/lib/systemd/system/opendaylight.service') do
- it { should be_file }
- it { should be_owned_by 'root' }
- it { should be_grouped_into 'root' }
- it { should be_mode '644' }
+ # Java 7 should be installed
+ describe package('java-1.7.0-openjdk') do
+ it { should be_installed }
+ end
+
+ # OpenDaylight will appear as a Java process
+ describe process('java') do
+ it { should be_running }
end
+
end
# Shared function for validations related to the Karaf config file
it { should be_file }
it { should be_owned_by 'odl' }
it { should be_grouped_into 'odl' }
- it { should be_mode '775' }
its(:content) { should match /^featuresBoot=#{features.join(",")}/ }
end
end
it { should be_installed }
end
end
+
+# Shared function that handles validations specific to tarball-type installs
+def tarball_validations()
+ describe yumrepo('opendaylight') do
+ it { should_not exist }
+ it { should_not be_enabled }
+ end
+
+ describe package('opendaylight') do
+ it { should_not be_installed }
+ end
+end