From fa5a34cd043ffc33fe3f9fd470a063f5138dee9f Mon Sep 17 00:00:00 2001 From: Thibault Vallin Date: Mon, 13 Jan 2025 20:03:56 +0100 Subject: [PATCH] Add Windows OS Github Worflow (#7227) --- .github/actions/common/action.yml | 5 +-- .github/workflows/validate.yml | 13 +++--- .../helidon/builder/test/CustomNamedTest.java | 8 +++- .../OciAuthenticationDetailsProvider.java | 10 ++++- .../telemetry/TestTracerAtStartup.java | 5 ++- .../testing/testng/HelidonTestNgListener.java | 3 +- .../telemetry/InMemorySpanExporter.java | 18 ++++----- .../InMemorySpanExporterProvider.java | 6 +-- .../telemetry/RestSpanHierarchyTest.java | 40 ++++++++----------- .../telemetry/TestFullUrlName.java | 37 ++++++++--------- .../integration/harness/ProcessRunner.java | 17 +++++++- .../messaging/connectors/jms/AckMpTest.java | 5 ++- .../integration/oidc/CommonLoginBase.java | 4 +- .../integration/oidc/CookieBasedLoginIT.java | 4 +- .../tests/integration/oidc/IdTokenIT.java | 11 +---- .../integration/oidc/QueryBasedLoginIT.java | 4 +- .../integration/oidc/RefreshTokenIT.java | 8 +--- .../native-image.properties | 5 ++- .../packaging/mp1/Mp1NativeTestIT.java | 7 +++- .../packaging/mp3/Mp3NativeTestIT.java | 7 +++- .../grpc/tests/GrpcClientUriTest.java | 8 +++- .../FileSystemContentHandler.java | 5 ++- .../tests/http2/EmptyFrameCntTest.java | 5 ++- .../tests/WebServerStopIdleTest.java | 20 +++++++++- .../tests/websocket/WsConversationClient.java | 4 +- 25 files changed, 150 insertions(+), 109 deletions(-) diff --git a/.github/actions/common/action.yml b/.github/actions/common/action.yml index 06916523fe1..1d4ded82bab 100644 --- a/.github/actions/common/action.yml +++ b/.github/actions/common/action.yml @@ -54,7 +54,7 @@ inputs: runs: using: "composite" steps: - - if: ${{ inputs.free-space == 'true' }} + - if: ${{ inputs.free-space == 'true' && runner.os != 'Windows'}} # See https://github.com/actions/runner-images/issues/2840 name: Free disk space shell: bash @@ -140,8 +140,7 @@ runs: run: ${{ inputs.run }} shell: bash - name: Archive test results - # https://github.com/actions/upload-artifact/issues/240 - if: ${{ inputs.test-artifact-name != '' && runner.os != 'Windows' && always() }} + if: ${{ inputs.test-artifact-name != '' && always() }} uses: actions/upload-artifact@v4 with: if-no-files-found: 'ignore' diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index cdf932620ec..21c4aff6ea8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -99,12 +99,13 @@ jobs: timeout-minutes: 30 strategy: matrix: - os: [ ubuntu-20.04 ] + os: [ ubuntu-20.04, windows-2022 ] moduleSet: [ core, it, dbclient, dbclient-oracle, others ] include: - { os: ubuntu-20.04, platform: linux } + - { os: windows-2022, platform: windows } runs-on: ${{ matrix.os }} - name: tests/${{ matrix.moduleSet }} + name: tests/${{ matrix.moduleSet }}-${{matrix.platform}} steps: - uses: actions/checkout@v4 with: @@ -112,7 +113,7 @@ jobs: - uses: ./.github/actions/common with: build-cache: read-only - test-artifact-name: tests-${{ matrix.moduleSet }} + test-artifact-name: tests-${{ matrix.moduleSet }}-${{ matrix.platform }} run: | mvn ${MAVEN_ARGS} \ -DreactorRule=tests \ @@ -311,11 +312,12 @@ jobs: timeout-minutes: 30 strategy: matrix: - os: [ ubuntu-20.04, macos-14 ] + os: [ ubuntu-20.04, macos-14, windows-2022 ] packaging: [ jar, jlink ] include: - { os: ubuntu-20.04, platform: linux } - { os: macos-14, platform: macos } + - { os: windows-2022, platform: windows } runs-on: ${{ matrix.os }} name: tests/packaging-${{ matrix.packaging }}-${{ matrix.platform }} steps: @@ -337,11 +339,12 @@ jobs: timeout-minutes: 30 strategy: matrix: - os: [ ubuntu-20.04, macos-14 ] + os: [ ubuntu-20.04, macos-14, windows-2022 ] module: [ mp-1, mp-2, mp-3, se-1, inject ] include: - { os: ubuntu-20.04, platform: linux } - { os: macos-14, platform: macos } + - { os: windows-2022, platform: windows } runs-on: ${{ matrix.os }} name: tests/native-image-${{ matrix.module }}-${{ matrix.platform }} steps: diff --git a/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java b/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java index 217023a93d6..d49b7cdae40 100644 --- a/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java +++ b/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024 Oracle and/or its affiliates. + * Copyright (c) 2022, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,11 @@ void testIt() throws Exception { .build(); DefaultPrettyPrinter printer = new DefaultPrettyPrinter(); String json = mapper.writer(printer).writeValueAsString(customNamed); - assertThat(json, equalTo("{\n" + " \"stringSet\" : [ \"b\", \"a\", \"y\" ]\n" + "}")); + assertThat(json, equalTo("{" + + System.lineSeparator() + + " \"stringSet\" : [ \"b\", \"a\", \"y\" ]" + + System.lineSeparator() + + "}")); } } diff --git a/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java b/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java index c1fc7dfdfa1..b37b1842252 100644 --- a/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java +++ b/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java @@ -16,6 +16,7 @@ package io.helidon.integrations.oci.sdk.runtime; +import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Path; @@ -159,7 +160,14 @@ static boolean canReadPath(String pathName) { } static String userHomePrivateKeyPath(OciConfig ociConfig) { - return Paths.get(System.getProperty("user.home"), ".oci", ociConfig.authKeyFile()).toString(); + return normalizePath(Paths.get(System.getProperty("user.home"), ".oci", ociConfig.authKeyFile()).toString()); + } + + private static String normalizePath(String value) { + if (value == null) { + return null; + } + return value.replace(File.separator, "/"); } diff --git a/microprofile/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestTracerAtStartup.java b/microprofile/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestTracerAtStartup.java index b8a4556a476..f43cfa313e7 100644 --- a/microprofile/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestTracerAtStartup.java +++ b/microprofile/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestTracerAtStartup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oracle and/or its affiliates. + * Copyright (c) 2024, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ import io.helidon.microprofile.testing.junit5.HelidonTest; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; @@ -29,6 +31,7 @@ class TestTracerAtStartup { @Test + @DisabledOnOs(value = OS.WINDOWS, disabledReason = "https://github.com/helidon-io/helidon/issues/9513") void checkForFullFeaturedTracerAtStartup() { assertThat("Global tracer from start-up extension", TestExtension.globalTracerAtStartup.unwrap(io.opentelemetry.api.trace.Tracer.class).getClass().getName(), diff --git a/microprofile/testing/testng/src/main/java/io/helidon/microprofile/testing/testng/HelidonTestNgListener.java b/microprofile/testing/testng/src/main/java/io/helidon/microprofile/testing/testng/HelidonTestNgListener.java index 27f6049ec89..284ba26d518 100644 --- a/microprofile/testing/testng/src/main/java/io/helidon/microprofile/testing/testng/HelidonTestNgListener.java +++ b/microprofile/testing/testng/src/main/java/io/helidon/microprofile/testing/testng/HelidonTestNgListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024 Oracle and/or its affiliates. + * Copyright (c) 2022, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,6 +106,7 @@ public void onBeforeClass(ITestClass iTestClass) { testClass = iTestClass.getRealClass(); HelidonTest testAnnot = testClass.getAnnotation(HelidonTest.class); if (testAnnot == null) { + helidonTest = false; return; } helidonTest = true; diff --git a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporter.java b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporter.java index ef6c3ae3d1d..adcb22f353a 100644 --- a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporter.java +++ b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,26 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.helidon.microprofile.telemetry; -import static java.util.Comparator.comparingLong; -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.hamcrest.MatcherAssert.assertThat; - import java.util.Collection; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Collectors; -import org.awaitility.Awaitility; - import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.export.SpanExporter; import jakarta.enterprise.context.ApplicationScoped; +import org.awaitility.Awaitility; import org.hamcrest.Matchers; +import static java.util.Comparator.comparingLong; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.hamcrest.MatcherAssert.assertThat; + @ApplicationScoped public class InMemorySpanExporter implements SpanExporter { private boolean isStopped = false; @@ -48,7 +46,8 @@ public List getFinishedSpanItems(int spanCount) { } public void assertSpanCount(int spanCount) { - Awaitility.await().pollDelay(3, SECONDS).atMost(10, SECONDS) + Awaitility.await() + .pollDelay(3, SECONDS).atMost(10, SECONDS) .untilAsserted(() -> assertThat(finishedSpanItems.size(), Matchers.is(spanCount))); } @@ -57,6 +56,7 @@ public void reset() { } @Override + @SuppressWarnings("NullableProblems") public CompletableResultCode export(Collection spans) { if (isStopped) { return CompletableResultCode.ofFailure(); diff --git a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporterProvider.java b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporterProvider.java index 089cfbefaea..0a5d89f2e0c 100644 --- a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporterProvider.java +++ b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/InMemorySpanExporterProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.helidon.microprofile.telemetry; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; @@ -21,6 +20,7 @@ import io.opentelemetry.sdk.trace.export.SpanExporter; import jakarta.enterprise.inject.spi.CDI; +@SuppressWarnings("NullableProblems") public class InMemorySpanExporterProvider implements ConfigurableSpanExporterProvider { @Override public SpanExporter createExporter(final ConfigProperties config) { @@ -31,4 +31,4 @@ public SpanExporter createExporter(final ConfigProperties config) { public String getName() { return "in-memory"; } -} \ No newline at end of file +} diff --git a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/RestSpanHierarchyTest.java b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/RestSpanHierarchyTest.java index 1966edbf482..1abdcb124eb 100644 --- a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/RestSpanHierarchyTest.java +++ b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/RestSpanHierarchyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,31 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package io.helidon.microprofile.telemetry; import java.util.List; -import io.helidon.http.Status; -import io.helidon.microprofile.telemetry.InMemorySpanExporterProvider; import io.helidon.microprofile.testing.junit5.AddBean; -import io.helidon.microprofile.testing.junit5.AddConfig; -import io.helidon.microprofile.testing.junit5.AddExtension; +import io.helidon.microprofile.testing.junit5.AddConfigBlock; import io.helidon.microprofile.testing.junit5.HelidonTest; +import io.helidon.tracing.Span; +import io.helidon.tracing.Tracer; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.annotations.WithSpan; import io.opentelemetry.sdk.trace.data.SpanData; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.Application; import jakarta.ws.rs.core.Response; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -53,10 +47,12 @@ @AddBean(RestSpanHierarchyTest.SpanResource.class) @AddBean(InMemorySpanExporter.class) @AddBean(InMemorySpanExporterProvider.class) -@AddConfig(key = "otel.service.name", value = "helidon-mp-telemetry") -@AddConfig(key = "otel.sdk.disabled", value = "false") -@AddConfig(key = "telemetry.span.full.url", value = "false") -@AddConfig(key = "otel.traces.exporter", value = "in-memory") +@AddConfigBlock(""" + otel.service.name=helidon-mp-telemetry + otel.sdk.disabled=false + otel.traces.exporter=in-memory + telemetry.span.full.url=false + """) public class RestSpanHierarchyTest { @Inject @@ -72,7 +68,6 @@ void setup() { @Test void spanHierarchy() { - assertThat(webTarget.path("mixed").request().get().getStatus(), is(Response.Status.OK.getStatusCode())); List spanItems = spanExporter.getFinishedSpanItems(4); @@ -81,12 +76,10 @@ void spanHierarchy() { assertThat(spanItems.get(0).getAttributes().get(AttributeKey.stringKey("attribute")), is("value")); assertThat(spanItems.get(0).getParentSpanId(), is(spanItems.get(1).getSpanId())); - assertThat(spanItems.get(1).getKind(), is(INTERNAL)); assertThat(spanItems.get(1).getName(), is("mixed_parent")); assertThat(spanItems.get(1).getParentSpanId(), is(spanItems.get(2).getSpanId())); - assertThat(spanItems.get(2).getKind(), is(SERVER)); assertThat(spanItems.get(2).getName(), is("/mixed")); } @@ -119,17 +112,16 @@ void spanHierarchyInjected() { public static class SpanResource { @Inject - private io.helidon.tracing.Tracer helidonTracerInjected; - + private Tracer helidonTracerInjected; @GET @Path("mixed") @WithSpan("mixed_parent") public Response mixedSpan() { - io.helidon.tracing.Tracer helidonTracer = io.helidon.tracing.Tracer.global(); - io.helidon.tracing.Span mixedSpan = helidonTracer.spanBuilder("mixed_inner") - .kind(io.helidon.tracing.Span.Kind.SERVER) + Tracer helidonTracer = Tracer.global(); + Span mixedSpan = helidonTracer.spanBuilder("mixed_inner") + .kind(Span.Kind.SERVER) .tag("attribute", "value") .start(); mixedSpan.end(); @@ -142,8 +134,8 @@ public Response mixedSpan() { @WithSpan("mixed_parent_injected") public Response mixedSpanInjected() { - io.helidon.tracing.Span mixedSpan = helidonTracerInjected.spanBuilder("mixed_inner_injected") - .kind(io.helidon.tracing.Span.Kind.SERVER) + Span mixedSpan = helidonTracerInjected.spanBuilder("mixed_inner_injected") + .kind(Span.Kind.SERVER) .tag("attribute", "value") .start(); mixedSpan.end(); diff --git a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestFullUrlName.java b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestFullUrlName.java index cbecd852b37..41422286bd7 100644 --- a/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestFullUrlName.java +++ b/microprofile/tests/telemetry/src/test/java/io/helidon/microprofile/telemetry/TestFullUrlName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,32 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.helidon.microprofile.telemetry; import java.util.List; +import java.util.stream.Collectors; -import io.helidon.http.Status; -import io.helidon.microprofile.telemetry.InMemorySpanExporter; -import io.helidon.microprofile.telemetry.InMemorySpanExporterProvider; import io.helidon.microprofile.testing.junit5.AddBean; import io.helidon.microprofile.testing.junit5.AddConfig; +import io.helidon.microprofile.testing.junit5.AddConfigBlock; import io.helidon.microprofile.testing.junit5.AddExtension; import io.helidon.microprofile.testing.junit5.HelidonTest; import io.opentelemetry.sdk.trace.data.SpanData; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.Application; import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.is; /** @@ -49,17 +46,17 @@ @AddBean(InMemorySpanExporter.class) @AddBean(InMemorySpanExporterProvider.class) @AddExtension(TelemetryCdiExtension.class) -@AddConfig(key = "otel.service.name", value = "helidon-mp-telemetry") -@AddConfig(key = "otel.sdk.disabled", value = "false") -@AddConfig(key = "telemetry.span.full.url", value = "true") -@AddConfig(key = "otel.traces.exporter", value = "in-memory") +@AddConfigBlock(""" + otel.service.name=helidon-mp-telemetry + otel.sdk.disabled=false + otel.traces.exporter=in-memory + telemetry.span.full.url=true + """) public class TestFullUrlName { - @Inject WebTarget webTarget; - @Inject InMemorySpanExporter spanExporter; @@ -73,12 +70,16 @@ void setup() { @Test void spanNaming() { - assertThat(webTarget.path("named").request().get().getStatus(), is(Response.Status.OK.getStatusCode())); - List spanItems = spanExporter.getFinishedSpanItems(2); - assertThat(spanItems.size(), is(2)); - assertThat(spanItems.get(0).getName(), is("http://localhost:" + webTarget.getUri().getPort() + "/named")); + List names = spanExporter.getFinishedSpanItems(2) + .stream() + .map(SpanData::getName) + .collect(Collectors.toList()); + + assertThat(names.size(), is(2)); + assertThat(names, hasItem("http://localhost:" + webTarget.getUri().getPort() + "/named")); + assertThat(names, hasItem("HTTP GET")); } @@ -93,4 +94,4 @@ public Response mixedSpan() { } } -} \ No newline at end of file +} diff --git a/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/ProcessRunner.java b/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/ProcessRunner.java index e26fc0fe572..361019127c3 100644 --- a/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/ProcessRunner.java +++ b/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/ProcessRunner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024 Oracle and/or its affiliates. + * Copyright (c) 2021, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import static java.util.Objects.requireNonNull; @@ -467,7 +468,19 @@ private static final class JlinkRunner extends ProcessRunner { @Override protected List command(List opts, List args) { Objects.requireNonNull(finalName, "finalName is null"); - return new CommandBuilder("target/" + finalName + "-jri/bin/start" + (IS_WINDOWS ? ".ps1" : "")) + if (IS_WINDOWS) { + return new CommandBuilder("powershell") + .append("-File") + .append("target/" + finalName + "-jri/bin/start.ps1") + .append("--jvm", opts.stream() + .map(option -> String.format("'%s'", option)) + .collect(Collectors.joining(" "))) + .append(args.stream() + .map(argument -> String.format("'%s'", argument)) + .collect(Collectors.joining(" "))) + .command(); + } + return new CommandBuilder("target/" + finalName + "-jri/bin/start") .append("--jvm", String.join(" ", opts)) .append(args) .command(); diff --git a/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java b/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java index fb8b9464839..6984209030d 100644 --- a/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java +++ b/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,8 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static java.lang.System.Logger.Level.DEBUG; @@ -106,6 +108,7 @@ void resendAckTestPart1(SeContainer cdi) { @Test @Order(2) + @DisabledOnOs(value = OS.WINDOWS, disabledReason = "https://github.com/helidon-io/helidon/issues/8509") void resendAckTestPart2(SeContainer cdi) { MockConnector mockConnector = cdi.select(MockConnector.class, TEST_CONNECTOR_ANNOTATION).get(); diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CommonLoginBase.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CommonLoginBase.java index 66c62d30ae4..941f062866e 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CommonLoginBase.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CommonLoginBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.empty; -@Testcontainers +@Testcontainers(disabledWithoutDocker = true) @HelidonTest(resetPerTest = true) @AddBean(TestResource.class) class CommonLoginBase { diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java index de5a78f20f4..6d6e5eeed4c 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,6 @@ import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.Form; import jakarta.ws.rs.core.Response; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_POST_LOGOUT_TEST_MESSAGE; diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/IdTokenIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/IdTokenIT.java index 5135c58f879..66f494933b7 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/IdTokenIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/IdTokenIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,33 +27,24 @@ import io.helidon.security.jwt.Jwt; import io.helidon.security.jwt.SignedJwt; import io.helidon.security.jwt.jwk.Jwk; -import io.helidon.security.providers.oidc.common.OidcConfig; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; -import jakarta.ws.rs.client.Entity; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.Form; import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static io.helidon.security.providers.oidc.common.OidcConfig.DEFAULT_ID_COOKIE_NAME; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE; -import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.empty; class IdTokenIT extends CommonLoginBase { diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java index 656122ba08e..371d87ed6f5 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,6 @@ import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE; diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/RefreshTokenIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/RefreshTokenIT.java index 2d06ef0fa0d..d98dac7c5a0 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/RefreshTokenIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/RefreshTokenIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,21 +33,15 @@ import jakarta.ws.rs.core.Form; import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.Response; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; -import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_POST_LOGOUT_TEST_MESSAGE; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE; import static org.hamcrest.CoreMatchers.hasItem; -import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.empty; @AddConfig(key = "security.providers.1.oidc.token-signature-validation", value = "false") diff --git a/tests/integration/packaging/mp-1/src/main/resources/META-INF/native-image/io.helidon.tests.integration.packaging/helidon-tests-integration-packaging-mp1/native-image.properties b/tests/integration/packaging/mp-1/src/main/resources/META-INF/native-image/io.helidon.tests.integration.packaging/helidon-tests-integration-packaging-mp1/native-image.properties index ceb51af7ac5..08b72583ee7 100644 --- a/tests/integration/packaging/mp-1/src/main/resources/META-INF/native-image/io.helidon.tests.integration.packaging/helidon-tests-integration-packaging-mp1/native-image.properties +++ b/tests/integration/packaging/mp-1/src/main/resources/META-INF/native-image/io.helidon.tests.integration.packaging/helidon-tests-integration-packaging-mp1/native-image.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2023, 2024 Oracle and/or its affiliates. +# Copyright (c) 2023, 2025 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,4 +14,5 @@ # limitations under the License. # -Args=--initialize-at-build-time=io.helidon.tests.integration.packaging.mp1 +Args=--initialize-at-build-time=io.helidon.tests.integration.packaging.mp1 \ + --trace-object-instantiation=java.lang.Thread diff --git a/tests/integration/packaging/mp-1/src/test/java/io/helidon/tests/integration/packaging/mp1/Mp1NativeTestIT.java b/tests/integration/packaging/mp-1/src/test/java/io/helidon/tests/integration/packaging/mp1/Mp1NativeTestIT.java index 9edd7bf03e2..0cc2f0ccf98 100644 --- a/tests/integration/packaging/mp-1/src/test/java/io/helidon/tests/integration/packaging/mp1/Mp1NativeTestIT.java +++ b/tests/integration/packaging/mp-1/src/test/java/io/helidon/tests/integration/packaging/mp1/Mp1NativeTestIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oracle and/or its affiliates. + * Copyright (c) 2024, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,12 @@ import io.helidon.tests.integration.harness.ProcessRunner.ExecMode; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; +@DisabledOnOs(value = OS.WINDOWS, + disabledReason = "JFR event recording is not supported on windows yet " + + "https://www.graalvm.org/latest/reference-manual/native-image/debugging-and-diagnostics/JFR/") class Mp1NativeTestIT extends Mp1PackagingTestIT { @Override diff --git a/tests/integration/packaging/mp-3/src/test/java/io/helidon/tests/integration/packaging/mp3/Mp3NativeTestIT.java b/tests/integration/packaging/mp-3/src/test/java/io/helidon/tests/integration/packaging/mp3/Mp3NativeTestIT.java index 50cf1bf1063..3d9d124f227 100644 --- a/tests/integration/packaging/mp-3/src/test/java/io/helidon/tests/integration/packaging/mp3/Mp3NativeTestIT.java +++ b/tests/integration/packaging/mp-3/src/test/java/io/helidon/tests/integration/packaging/mp3/Mp3NativeTestIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oracle and/or its affiliates. + * Copyright (c) 2024, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,12 @@ import io.helidon.tests.integration.harness.ProcessRunner.ExecMode; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; +@DisabledOnOs(value = OS.WINDOWS, + disabledReason = "JFR event recording is not supported on windows yet " + + "https://www.graalvm.org/latest/reference-manual/native-image/debugging-and-diagnostics/JFR/") class Mp3NativeTestIT extends Mp3PackagingTestIT { @Override diff --git a/webclient/tests/grpc/src/test/java/io/helidon/webclient/grpc/tests/GrpcClientUriTest.java b/webclient/tests/grpc/src/test/java/io/helidon/webclient/grpc/tests/GrpcClientUriTest.java index a602688d6b4..f20e38187ba 100644 --- a/webclient/tests/grpc/src/test/java/io/helidon/webclient/grpc/tests/GrpcClientUriTest.java +++ b/webclient/tests/grpc/src/test/java/io/helidon/webclient/grpc/tests/GrpcClientUriTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oracle and/or its affiliates. + * Copyright (c) 2024, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package io.helidon.webclient.grpc.tests; import java.net.URI; +import java.time.Duration; import java.util.concurrent.CountDownLatch; import io.helidon.common.configurable.Resource; @@ -87,7 +88,10 @@ void testSupplierWithRetries() { .build(); StringServiceGrpc.StringServiceBlockingStub service = StringServiceGrpc.newBlockingStub(grpcClient.channel()); - Retry retry = Retry.builder().calls(2).build(); + Retry retry = Retry.builder() + .overallTimeout(Duration.ofMillis(5000)) + .calls(2) + .build(); Strings.StringMessage res = retry.invoke(() -> service.upper(newStringMessage("hello"))); assertThat(res.getText(), is("HELLO")); assertThat(latch.getCount(), is(0L)); diff --git a/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java index 233c46670e0..c1dc144df69 100644 --- a/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024 Oracle and/or its affiliates. + * Copyright (c) 2017, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package io.helidon.webserver.staticcontent; +import java.io.File; import java.io.IOException; import java.lang.System.Logger.Level; import java.nio.file.Files; @@ -88,7 +89,7 @@ boolean doHandle(Method method, String requestedPath, ServerRequest req, ServerR String rawPath = req.prologue().uriPath().rawPath(); - String relativePath = root.relativize(path).toString().replace("\\", "/"); + String relativePath = root.relativize(path).toString().replace(File.separator, "/"); String requestedResource; if (mapped) { requestedResource = relativePath; diff --git a/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/EmptyFrameCntTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/EmptyFrameCntTest.java index d4358b7ea15..26522aa4da0 100644 --- a/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/EmptyFrameCntTest.java +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/EmptyFrameCntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +60,8 @@ import io.helidon.webserver.testing.junit5.SetUpServer; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static io.helidon.http.Method.GET; import static io.netty.handler.codec.http2.Http2CodecUtil.FRAME_HEADER_LENGTH; @@ -68,6 +70,7 @@ import static org.hamcrest.Matchers.is; @ServerTest +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "https://github.com/helidon-io/helidon/issues/8510") class EmptyFrameCntTest { private static final Duration TIMEOUT = Duration.ofSeconds(10); diff --git a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java index d389c50c6d7..4fda4877cc4 100644 --- a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,9 @@ import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -29,7 +32,20 @@ class WebServerStopIdleTest { @Test + @DisabledOnOs(OS.WINDOWS) void stopWhenIdleExpectTimelyStop() { + stopWhenIdleExpectTimelyStop(500); + } + + @Test + @EnabledOnOs( + value = OS.WINDOWS, + disabledReason = "Slow pipeline runner make it stop a few millisecond later") + void stopWhenIdleExpectTimelyStopWindows() { + stopWhenIdleExpectTimelyStop(505); + } + + void stopWhenIdleExpectTimelyStop(int timeout) { WebServer webServer = WebServer.builder() .routing(router -> router.get("ok", (req, res) -> res.send("ok"))) .build(); @@ -46,6 +62,6 @@ void stopWhenIdleExpectTimelyStop() { long startMillis = System.currentTimeMillis(); webServer.stop(); int stopExecutionTimeInMillis = (int) (System.currentTimeMillis() - startMillis); - assertThat(stopExecutionTimeInMillis, is(lessThan(500))); + assertThat(stopExecutionTimeInMillis, is(lessThan(timeout))); } } diff --git a/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java index ee8be9d9da3..3afd769da1c 100644 --- a/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,6 @@ import static io.helidon.webserver.tests.websocket.WsAction.OperationType.TEXT; import static java.nio.charset.StandardCharsets.UTF_8; -; - /** * A websocket client that is driven by a conversation instance. */