From 2d535cc609c1036625c5e56b681ea0fc42bbf327 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sun, 19 Apr 2026 08:31:52 +0200 Subject: [PATCH 1/2] Disable flaky SSH tests on Windows --- .../karaf/itests/ssh/BundleSshCommandSecurityTest.java | 6 ++++++ .../karaf/itests/ssh/ConfigSshCommandSecurityTest.java | 10 ++++++++++ .../karaf/itests/ssh/SystemCommandSecurityTest.java | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/itests/test/src/test/java/org/apache/karaf/itests/ssh/BundleSshCommandSecurityTest.java b/itests/test/src/test/java/org/apache/karaf/itests/ssh/BundleSshCommandSecurityTest.java index be2474aeae4..3ac60a0f68c 100644 --- a/itests/test/src/test/java/org/apache/karaf/itests/ssh/BundleSshCommandSecurityTest.java +++ b/itests/test/src/test/java/org/apache/karaf/itests/ssh/BundleSshCommandSecurityTest.java @@ -13,6 +13,7 @@ */ package org.apache.karaf.itests.ssh; +import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; @@ -32,6 +33,11 @@ public class BundleSshCommandSecurityTest extends SshCommandTestBase { @Test public void testBundleCommandSecurityViaSsh() throws Exception { + // Skip on Windows where PTY output can be garbled, + // when upgrading to Junit5, this can be replaced with @DisabledOnOs(OS.WINDOWS) + // TODO: remove this once we have a better solution for PTY output on Windows + Assume.assumeFalse(System.getProperty("os.name", "").toLowerCase().contains("win")); + String manageruser = "man" + System.nanoTime() + "_" + counter++; String vieweruser = "view" + System.nanoTime() + "_" + counter++; diff --git a/itests/test/src/test/java/org/apache/karaf/itests/ssh/ConfigSshCommandSecurityTest.java b/itests/test/src/test/java/org/apache/karaf/itests/ssh/ConfigSshCommandSecurityTest.java index 9388828fefd..97695cc094b 100644 --- a/itests/test/src/test/java/org/apache/karaf/itests/ssh/ConfigSshCommandSecurityTest.java +++ b/itests/test/src/test/java/org/apache/karaf/itests/ssh/ConfigSshCommandSecurityTest.java @@ -13,6 +13,7 @@ */ package org.apache.karaf.itests.ssh; +import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; @@ -33,6 +34,10 @@ public class ConfigSshCommandSecurityTest extends SshCommandTestBase { @Test public void testConfigCommandSecurityViaSsh() throws Exception { + // Skip on Windows where PTY output can be garbled, + // when upgrading to Junit5, this can be replaced with @DisabledOnOs(OS.WINDOWS) + // TODO: remove this once we have a better solution for PTY output on Windows + Assume.assumeFalse(System.getProperty("os.name", "").toLowerCase().contains("win")); String manageruser = "man" + System.nanoTime() + "_" + counter++; String vieweruser = "view" + System.nanoTime() + "_" + counter++; @@ -90,6 +95,11 @@ private void testConfigEdits(String user, Result expectedEditResult, String pid, @Test public void testConfigCommandSecurityWithoutEditSessionViaSsh() throws Exception { + // Skip on Windows where PTY output can be garbled, + // when upgrading to Junit5, this can be replaced with @DisabledOnOs(OS.WINDOWS) + // TODO: remove this once we have a better solution for PTY output on Windows + Assume.assumeFalse(System.getProperty("os.name", "").toLowerCase().contains("win")); + String manageruser = "man" + System.nanoTime() + "_" + counter++; String vieweruser = "view" + System.nanoTime() + "_" + counter++; diff --git a/itests/test/src/test/java/org/apache/karaf/itests/ssh/SystemCommandSecurityTest.java b/itests/test/src/test/java/org/apache/karaf/itests/ssh/SystemCommandSecurityTest.java index 4a6d5545811..18f5f405b17 100644 --- a/itests/test/src/test/java/org/apache/karaf/itests/ssh/SystemCommandSecurityTest.java +++ b/itests/test/src/test/java/org/apache/karaf/itests/ssh/SystemCommandSecurityTest.java @@ -14,6 +14,7 @@ package org.apache.karaf.itests.ssh; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; @@ -31,6 +32,11 @@ public class SystemCommandSecurityTest extends SshCommandTestBase { @Test public void testSystemCommandSecurityViaSsh() throws Exception { + // Skip on Windows where PTY output can be garbled, + // when upgrading to Junit5, this can be replaced with @DisabledOnOs(OS.WINDOWS) + // TODO: remove this once we have a better solution for PTY output on Windows + Assume.assumeFalse(System.getProperty("os.name", "").toLowerCase().contains("win")); + String manageruser = "man" + System.nanoTime() + "_" + counter++; String vieweruser = "view" + System.nanoTime() + "_" + counter++; From c984c962b2260e1b958b2b0f38f3f8aba8ab9a74 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sun, 19 Apr 2026 15:15:09 +0200 Subject: [PATCH 2/2] more tests disabled --- .../karaf/itests/ssh/FeatureSshCommandSecurityTest.java | 6 ++++++ .../apache/karaf/itests/ssh/JaasSshCommandSecurityTest.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/itests/test/src/test/java/org/apache/karaf/itests/ssh/FeatureSshCommandSecurityTest.java b/itests/test/src/test/java/org/apache/karaf/itests/ssh/FeatureSshCommandSecurityTest.java index 30463de3c49..0ec55c3d720 100644 --- a/itests/test/src/test/java/org/apache/karaf/itests/ssh/FeatureSshCommandSecurityTest.java +++ b/itests/test/src/test/java/org/apache/karaf/itests/ssh/FeatureSshCommandSecurityTest.java @@ -14,6 +14,7 @@ package org.apache.karaf.itests.ssh; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; /** @@ -26,6 +27,11 @@ public class FeatureSshCommandSecurityTest extends SshCommandTestBase { @Test public void testFeatureCommandSecurityViaSsh() throws Exception { + // Skip on Windows where PTY output can be garbled, + // when upgrading to Junit5, this can be replaced with @DisabledOnOs(OS.WINDOWS) + // TODO: remove this once we have a better solution for PTY output on Windows + Assume.assumeFalse(System.getProperty("os.name", "").toLowerCase().contains("win")); + String vieweruser = "viewer" + System.nanoTime() + "_features"; String feature = "wrapper"; diff --git a/itests/test/src/test/java/org/apache/karaf/itests/ssh/JaasSshCommandSecurityTest.java b/itests/test/src/test/java/org/apache/karaf/itests/ssh/JaasSshCommandSecurityTest.java index 65f59e30978..c5a10e2579c 100644 --- a/itests/test/src/test/java/org/apache/karaf/itests/ssh/JaasSshCommandSecurityTest.java +++ b/itests/test/src/test/java/org/apache/karaf/itests/ssh/JaasSshCommandSecurityTest.java @@ -16,6 +16,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.junit.Assume; import org.junit.Test; /** @@ -27,6 +28,10 @@ public class JaasSshCommandSecurityTest extends SshCommandTestBase { @Test public void testJaasCommandSecurityViaSsh() throws Exception { + // Skip on Windows where PTY output can be garbled, + // when upgrading to Junit5, this can be replaced with @DisabledOnOs(OS.WINDOWS) + // TODO: remove this once we have a better solution for PTY output on Windows + String vieweruser = "viewer" + System.nanoTime() + "_jaas"; addViewer(vieweruser);