Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ github:
required_status_checks:
strict: false
contexts:
- build
- test
- "build (ubuntu-24.04)"
- "build (windows-latest)"
- "build (macos-latest)"
- "test (ubuntu-24.04)"
- "test (windows-latest)"
- "test (macos-latest)"
karaf-4.4.x:
required_pull_request_reviews:
require_code_owner_reviews: false
Expand All @@ -51,8 +55,12 @@ github:
required_status_checks:
strict: false
contexts:
- build
- test
- "build (ubuntu-24.04)"
- "build (windows-latest)"
- "build (macos-latest)"
- "test (ubuntu-24.04)"
- "test (windows-latest)"
- "test (macos-latest)"

features:
wiki: false
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ jobs:
uses: dawidd6/action-download-artifact@v19
with:
run_id: ${{ github.event.workflow_run.id }}
name: test-results
name: test-results-.*
name_is_regexp: true
path: artifacts

- name: Download Event File
uses: dawidd6/action-download-artifact@v19
with:
run_id: ${{ github.event.workflow_run.id }}
name: event-file
name: event-file-.*
name_is_regexp: true
path: event

- name: Publish Test Results
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ on:

jobs:
build:
name: build
name: build (${{ matrix.os }})

permissions:
contents: read

runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, windows-latest, macos-latest ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand All @@ -48,18 +53,23 @@ jobs:
- name: Save Maven Local Repository
uses: actions/upload-artifact@v7
with:
name: maven-local-repo
name: maven-local-repo-${{ matrix.os }}
path: ~/.m2/repository
retention-days: 1

test:
name: test
name: test (${{ matrix.os }})
needs: build

permissions:
contents: read

runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, windows-latest, macos-latest ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand All @@ -73,7 +83,7 @@ jobs:
- name: Restore Maven Local Repository
uses: actions/download-artifact@v4
with:
name: maven-local-repo
name: maven-local-repo-${{ matrix.os }}
path: ~/.m2/repository
- name: Test
run: mvn -B -e install -Ptest
Expand All @@ -82,11 +92,11 @@ jobs:
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
name: test-results-${{ matrix.os }}
path: '**/target/surefire-reports/*.xml'
- name: Upload Event File
if: always()
uses: actions/upload-artifact@v7
with:
name: event-file
name: event-file-${{ matrix.os }}
path: ${{ github.event_path }}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void testPrint() throws UnsupportedEncodingException {
PrintStream out = new PrintStream(baos);
new EventPrinter(out, false).accept(event());
String result = baos.toString("utf-8");
assertThat(result, equalTo("2016-01-01 12:00:00 - myTopic\n"));
assertThat(result, equalTo("2016-01-01 12:00:00 - myTopic" + System.lineSeparator()));
}

@Test
Expand All @@ -50,9 +50,9 @@ public void testPrintVerbose() throws UnsupportedEncodingException {
PrintStream out = new PrintStream(baos);
new EventPrinter(out, true).accept(event());
String result = baos.toString("utf-8");
assertThat(result, equalTo("2016-01-01 12:00:00 - myTopic\n"
+ "a: b\n"
+ "c: [d, e]\n\n"));
assertThat(result, equalTo("2016-01-01 12:00:00 - myTopic" + System.lineSeparator()
+ "a: b" + System.lineSeparator()
+ "c: [d, e]" + System.lineSeparator() + System.lineSeparator()));
}

private Event event() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) thro
return FileVisitResult.CONTINUE;
}

String entryName = sourcePath.relativize(file).toString();
String entryName = sourcePath.relativize(file).toString().replace('\\', '/');

if (Paths.get(entryName).normalize().equals(destinationPath)) {
// Prevent the zip from trying to zip itself when ran in the instance directory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,13 @@ public void listViaMBean() throws Exception {

@Test
public void capabilitiesCommand() throws Exception {
String allCapabilitiesOutput = executeCommand("bundle:capabilities", ADMIN_ROLES);
System.out.println(allCapabilitiesOutput);
assertFalse(allCapabilitiesOutput.isEmpty());
String jmxWhiteboardBundleCapabilitiesOutput = executeCommand("bundle:capabilities org.apache.aries.jmx.whiteboard", ADMIN_ROLES);
System.out.println(jmxWhiteboardBundleCapabilitiesOutput);
assertContains("osgi.wiring.bundle; org.apache.aries.jmx.whiteboard 1.2.0 [UNUSED]", jmxWhiteboardBundleCapabilitiesOutput);
}

@Test
public void classesCommand() throws Exception {
String allClassesOutput = executeCommand("bundle:classes", ADMIN_ROLES);
assertFalse(allClassesOutput.isEmpty());
String jmxWhiteboardBundleClassesOutput = executeCommand("bundle:classes org.apache.aries.jmx.whiteboard", ADMIN_ROLES);
System.out.println(jmxWhiteboardBundleClassesOutput);
assertContains("org/apache/aries/jmx/whiteboard/Activator$MBeanTracker.class", jmxWhiteboardBundleClassesOutput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void listShortCommand() throws Exception {
String configListOutput = executeCommand("config:list -s");
System.out.println(configListOutput);
assertFalse(configListOutput.isEmpty());
assertContains("org.apache.karaf.jaas\norg.apache.karaf.kar\n", configListOutput);
assertContains("org.apache.karaf.jaas", configListOutput);
assertContains("org.apache.karaf.kar", configListOutput);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public void testFeatureCommandSecurityViaSsh() throws Exception {

addViewer(vieweruser);

// Ensure wrapper feature is not installed before starting the test
assertCommand("karaf", "feature:uninstall -r " + feature, Result.OK);

String r = assertCommand(vieweruser, "feature:list -i --no-format", Result.OK);
Assert.assertFalse("Precondition failed, this test uses the " + feature + " subsystem to test features with...",
r.contains(feature));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;

import org.apache.karaf.itests.BaseTest;
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.channel.ChannelShell;
import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.client.session.ClientSession.ClientSessionEvent;
import org.apache.sshd.common.channel.PtyMode;
import org.awaitility.Awaitility;
import org.junit.Assert;
import org.junit.runner.RunWith;
Expand All @@ -42,7 +46,7 @@ public class SshCommandTestBase extends BaseTest {
enum Result { OK, NOT_FOUND, NO_CREDENTIALS }

private SshClient client;
private ClientChannel channel;
private ChannelShell channel;
private ClientSession session;

void addUsers(String manageruser, String vieweruser) throws Exception {
Expand Down Expand Up @@ -126,7 +130,11 @@ private OutputStream openSshChannel(String username, String password, OutputStre
return true;
});

channel = session.createChannel("shell");
channel = session.createShellChannel();
// Disable terminal echo to prevent garbled output on Windows where
// each typed character gets echoed back into the output stream
Map<PtyMode, Integer> ptyModes = Collections.singletonMap(PtyMode.ECHO, 0);
channel.setPtyModes(ptyModes);
PipedOutputStream pipe = new PipedOutputStream();
channel.setIn(new PipedInputStream(pipe));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ public void testLostMasterLockAfterThreshold() throws Exception {

// lets wait until the start level change is complete - thrice
// (lostThreshold)
Thread.sleep(5000);
// Use polling instead of fixed sleep to avoid timing issues on slower CI platforms
long deadline = System.currentTimeMillis() + 30_000;
while (sl.getStartLevel() != 1 && System.currentTimeMillis() < deadline) {
Thread.sleep(200);
}
Assert.assertEquals(1, sl.getStartLevel());

Thread.sleep(1000);
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,13 @@
<configuration>
<argLine>
--add-opens java.base/java.security=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.naming/javax.naming.spi=ALL-UNNAMED
--add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED
</argLine>
<forkedProcessExitTimeoutInSeconds>30</forkedProcessExitTimeoutInSeconds>
</configuration>
</plugin>
<plugin>
Expand Down
Loading