#
# Tests that are common to all possible configurations
-def generic_tests()
+def generic_tests(options = {})
+ java_opts = options.fetch(:java_opts, '-Djava.net.preferIPv4Stack=true')
+
# Confirm that module compiles
it { should compile }
it { should compile.with_all_deps }
'group' => 'odl',
)
}
+
+ it {
+ should contain_file_line('Karaf Java Options').with(
+ 'ensure' => 'present',
+ 'path' => '/opt/opendaylight/bin/karaf',
+ 'line' => "JAVA_OPTS=#{java_opts}",
+ 'match' => '^JAVA_OPTS=.*$',
+ 'after' => '^PROGNAME=.*$'
+ )
+ }
+
end
# Shared tests that specialize in testing log file size and rollover
if log_mechanism == 'console'
it {
- should contain_file_line('rootlogger').with(
+ should contain_file_line('consoleappender').with(
'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
- 'line' => 'log4j.rootLogger=INFO, stdout, osgi:*',
- 'match' => '^log4j.rootLogger.*$',
- )
- }
- it {
- should contain_file_line('logappender').with(
- 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
- 'line' => 'log4j.appender.stdout.direct=true',
- 'after' => 'log4j.appender.stdout=org.apache.log4j.ConsoleAppender',
- 'match' => '^log4j.appender.stdout.direct.*$'
+ 'line' => 'karaf.log.console=INFO',
+ 'after' => 'log4j2.rootLogger.appenderRef.Console.filter.threshold.type = ThresholdFilter',
+ 'match' => '^karaf.log.console.*$'
)
}
else
- it {
- should contain_file_line('logmaxsize').with(
- 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
- 'line' => "log4j.appender.out.maxFileSize=#{log_max_size}",
- 'match' => '^log4j.appender.out.maxFileSize.*$',
- )
- }
- it {
- should contain_file_line('logmaxrollover').with(
- 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
- 'line' => "log4j.appender.out.maxBackupIndex=#{log_max_rollover}",
- 'match' => '^log4j.appender.out.maxBackupIndex.*$',
- )
- }
+ it {
+ should contain_file_line('logmaxsize').with(
+ 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+ 'line' => "log4j2.appender.rolling.policies.size.size = #{log_max_size}",
+ 'match' => '^log4j2.appender.rolling.policies.size.size.*$',
+ )
+ }
+ it {
+ should contain_file_line('rolloverstrategy').with(
+ 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+ 'line' => 'log4j2.appender.rolling.strategy.type = DefaultRolloverStrategy'
+ )
+ }
+ it {
+ should contain_file_line('logmaxrollover').with(
+ 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+ 'line' => "log4j2.appender.rolling.strategy.max = #{log_max_rollover}",
+ 'match' => '^log4j2.appender.rolling.strategy.max.*$',
+ )
+ }
end
end
# Extract params
# NB: This default value should be the same as one in opendaylight::params
# TODO: Remove this possible source of bugs^^
- odl_rest_port = options.fetch(:odl_rest_port, 8080)
+ odl_rest_port = options.fetch(:odl_rest_port, 8181)
odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
# Confirm properties of ODL REST port config file
# NB: These hashes don't work with Ruby 1.8.7, but we
should_not contain_augeas('ODL REST IP')
}
end
+
+ it {
+ should contain_file_line('set pax bind port').with(
+ 'ensure' => 'present',
+ 'path' => '/opt/opendaylight/etc/org.ops4j.pax.web.cfg',
+ 'line' => "org.osgi.service.http.port = #{odl_rest_port}",
+ 'require' => 'File[org.ops4j.pax.web.cfg]'
+ )
+ }
end
def log_level_tests(options = {})
if log_levels.empty?
# Should contain log level config file
it {
- should_not contain_file_line('logger-org.opendaylight.ovsdb')
+ should_not contain_file_line('logger-org.opendaylight.ovsdb-level')
+ }
+ it {
+ should_not contain_file_line('logger-org.opendaylight.ovsdb-name')
}
else
# Verify each custom log level config entry
log_levels.each_pair do |logger, level|
+ underscored_version = "#{logger}".gsub('.', '_')
it {
- should contain_file_line("logger-#{logger}").with(
+ should contain_file_line("logger-#{logger}-level").with(
+ 'ensure' => 'present',
+ 'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+ 'line' => "log4j2.logger.#{underscored_version}.level = #{level}",
+ 'match' => "log4j2.logger.#{underscored_version}.level = .*$"
+ )
+ should contain_file_line("logger-#{logger}-name").with(
'ensure' => 'present',
'path' => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
- 'line' => "log4j.logger.#{logger}=#{level}",
+ 'line' => "log4j2.logger.#{underscored_version}.name = #{logger}",
+ 'match' => "log4j2.logger.#{underscored_version}.name = .*$"
)
}
end
def rpm_install_tests(options = {})
# Extract params
rpm_repo = options.fetch(:rpm_repo, 'https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-$basearch-devel')
- java_opts = options.fetch(:java_opts, '-Djava.net.preferIPv4Stack=true')
+
# Default to CentOS 7 Yum repo URL
'ensure' => 'present',
)
}
-
- it {
- should contain_file_line('java_options_systemd').with(
- 'ensure' => 'present',
- 'path' => '/usr/lib/systemd/system/opendaylight.service',
- 'line' => "Environment=_JAVA_OPTIONS=\'#{java_opts}\'",
- 'after' => 'ExecStart=/opt/opendaylight/bin/start',
- )
- }
end
def deb_install_tests(options = {})
tls_key_file = options.fetch(:tls_key_file, nil)
tls_cert_file = options.fetch(:tls_cert_file, nil)
tls_ca_cert_file = options.fetch(:tls_ca_cert_file, nil)
- odl_rest_port = options.fetch(:odl_rest_port, 8080)
+ odl_rest_port = options.fetch(:odl_rest_port, 8181)
if enable_tls
if tls_keystore_password.nil?