This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.4.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.4.x by this push:
     new 846fcd77c9 [4.4.x] fix(itests): stop LogTest racing fileinstall's 
config write-back (#3067) (#3068)
846fcd77c9 is described below

commit 846fcd77c97b94640049a58a5bec092b9301f7b0
Author: JB Onofré <[email protected]>
AuthorDate: Sat Nov 7 05:45:48 2026 +0000

    [4.4.x] fix(itests): stop LogTest racing fileinstall's config write-back 
(#3067) (#3068)
    
    LogTest fails now and then on Linux CI with "Unrecognized configuration"
    on log:set, and once it happens every remaining test of the class fails.
    
    Every log:set updates the org.ops4j.pax.logging configuration, which
    fileinstall writes back to etc/org.ops4j.pax.logging.cfg in place: the
    file is truncated, then rewritten. The fileinstall scanner should only
    pick up a file once it stopped changing, but its second checksum pass
    in the same scan defeats that check, so a single poll landing while the
    file is truncated loads it empty into ConfigAdmin. The write-back of
    that empty configuration then removes every key from the file, so the
    configuration never recovers.
    
    LogTest checks the log commands against ConfigAdmin, not against the
    file, so disable fileinstall's config write-back in its container.
    
    (cherry picked from commit 902f633091609924eab180991d91df4efe45e97b)
---
 .../test/src/test/java/org/apache/karaf/itests/LogTest.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/itests/test/src/test/java/org/apache/karaf/itests/LogTest.java 
b/itests/test/src/test/java/org/apache/karaf/itests/LogTest.java
index ee9e9aa6d4..b8e21f4f64 100644
--- a/itests/test/src/test/java/org/apache/karaf/itests/LogTest.java
+++ b/itests/test/src/test/java/org/apache/karaf/itests/LogTest.java
@@ -15,6 +15,8 @@ package org.apache.karaf.itests;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 
 import javax.management.Attribute;
 import javax.management.MBeanServer;
@@ -22,6 +24,8 @@ import javax.management.ObjectName;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
@@ -43,6 +47,15 @@ public class LogTest extends BaseTest {
     // that is never registered (the default would block 30 seconds on every 
call)
     private static final long NO_WAIT = 0L;
 
+    @Configuration
+    public Option[] config() {
+        // Every log:set rewrites etc/org.ops4j.pax.logging.cfg in place 
(fileinstall config save). A fileinstall poll
+        // landing while the file is truncated loads it empty into 
ConfigAdmin, and the write-back of that empty
+        // configuration then strips the file: every later log command fails 
with "Unrecognized configuration".
+        // These tests check the log commands against ConfigAdmin, not the 
file, so don't write the file back.
+        return combine(super.config(), 
editConfigurationFilePut("etc/config.properties", 
"felix.fileinstall.enableConfigSave", "false"));
+    }
+
     @Test
     public void setDebugAndDisplay() throws Exception {
         assertSetLevel("DEBUG");

Reply via email to