Merge "Add boolean flag to disable the PaxOsgi appender"
[integration/packaging/puppet-opendaylight.git] / spec / spec_helper.rb
index 0be7c349e3ff1b534a1e2b177a89083024f8f24b..3318939e7725762859afd5c4877b14b47d71a469 100644 (file)
@@ -122,6 +122,7 @@ def log_settings(options = {})
   log_rollover_fileindex = options.fetch(:log_rollover_fileindex, 'min')
   log_pattern = options.fetch(:log_pattern, '%d{ISO8601} | %-5p | %-16t | %-60c{6} | %m%n')
   log_mechanism = options.fetch(:log_mechanism, 'file')
+  enable_paxosgi_logger = options.fetch(:enable_paxosgi_logger, false)
 
   if log_mechanism == 'console'
     it {
@@ -177,6 +178,43 @@ def log_settings(options = {})
       'match'  => '^log4j2.pattern.*$',
     )
   }
+  if enable_paxosgi_logger == true
+      presence = 'present'
+  else
+      presence = 'absent'
+  end
+
+  it {
+    should contain_file_line('paxosgiappenderref').with(
+      'ensure' => presence,
+      'path'   => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+      'line'   => "log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi",
+    )
+  }
+  it {
+    should contain_file_line('paxosgisection').with(
+      'path'   => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+      'line'   => "# OSGi appender",
+    )
+  }
+  it {
+    should contain_file_line('paxosgitype').with(
+      'path'   => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+      'line'   => "log4j2.appender.osgi.type = PaxOsgi",
+    )
+  }
+  it {
+    should contain_file_line('paxosginame').with(
+      'path'   => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+      'line'   => "log4j2.appender.osgi.name = PaxOsgi",
+    )
+  }
+  it {
+    should contain_file_line('paxosgifilter').with(
+      'path'   => '/opt/opendaylight/etc/org.ops4j.pax.logging.cfg',
+      'line'   => "log4j2.appender.osgi.filter = *",
+    )
+  }
 end
 
 # Shared tests that specialize in testing Karaf feature installs