From fb831a367eb658111260662c91d0f9e086f2853d Mon Sep 17 00:00:00 2001 From: SebastienDegodez Date: Sun, 11 Jan 2026 21:09:19 +0100 Subject: [PATCH] refactor: remove MacOSHelper and its usage from the codebase Signed-off-by: SebastienDegodez --- .../Helpers/MacOSHelper.cs | 54 ------------------- .../MicrocksBuilder.cs | 1 - .../MicrocksContainerEnsemble.cs | 2 - .../Helpers/MacOSHelperTests.cs | 51 ------------------ ...ractTestingFunctionalityWithOAuth2Tests.cs | 1 - 5 files changed, 109 deletions(-) delete mode 100644 src/Microcks.Testcontainers/Helpers/MacOSHelper.cs delete mode 100644 tests/Microcks.Testcontainers.Tests/Helpers/MacOSHelperTests.cs diff --git a/src/Microcks.Testcontainers/Helpers/MacOSHelper.cs b/src/Microcks.Testcontainers/Helpers/MacOSHelper.cs deleted file mode 100644 index c7e2000..0000000 --- a/src/Microcks.Testcontainers/Helpers/MacOSHelper.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright The Microcks Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// - -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: InternalsVisibleTo("Microcks.Testcontainers.Tests")] - -namespace Microcks.Testcontainers.Helpers; - -/// -/// A temporary helper class for MacOS to fix SIGILL error. -/// Note: This is a temporary fix and should be removed in the near future because Java 21.0.7 has not yet landed into the Red Hat base image we're using for Microcks but it should come very soon. -/// -public static class MacOSHelper -{ - /// - /// Gets a value indicating whether the current process is running on macOS (Darwin) on Arm64. - /// - public static bool IsMacOS { get; internal set; } - = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 - && RuntimeInformation.OSDescription.Contains("Darwin"); - - /// - /// Get Java options for MacOS M4 to fix SIGILL error. - /// - /// - public static IReadOnlyDictionary GetJavaOptions(string keyname = "JAVA_OPTIONS") - { - if (IsMacOS) - { - return new Dictionary - { - { keyname, "-XX:UseSVE=0" } - }; - } - - return new Dictionary(); - } -} diff --git a/src/Microcks.Testcontainers/MicrocksBuilder.cs b/src/Microcks.Testcontainers/MicrocksBuilder.cs index c72a809..f7ad96f 100644 --- a/src/Microcks.Testcontainers/MicrocksBuilder.cs +++ b/src/Microcks.Testcontainers/MicrocksBuilder.cs @@ -135,7 +135,6 @@ private void ContainerStarted(MicrocksContainer container) protected override MicrocksBuilder Init() { return base.Init() - .WithEnvironment(MacOSHelper.GetJavaOptions()) .WithImage(_microcksImage) .WithPortBinding(MicrocksHttpPort, true) .WithPortBinding(MicrocksGrpcPort, true) diff --git a/src/Microcks.Testcontainers/MicrocksContainerEnsemble.cs b/src/Microcks.Testcontainers/MicrocksContainerEnsemble.cs index 00f9cd7..b234c1b 100644 --- a/src/Microcks.Testcontainers/MicrocksContainerEnsemble.cs +++ b/src/Microcks.Testcontainers/MicrocksContainerEnsemble.cs @@ -87,7 +87,6 @@ public MicrocksContainerEnsemble(INetwork network, string microcksImage) .WithNetworkAliases("microcks") .WithExposedPort(MicrocksBuilder.MicrocksHttpPort) .WithExposedPort(MicrocksBuilder.MicrocksGrpcPort) - .WithEnvironment(MacOSHelper.GetJavaOptions()) .WithEnvironment("POSTMAN_RUNNER_URL", "http://postman:3000") .WithEnvironment("TEST_CALLBACK_URL", "http://microcks:" + MicrocksBuilder.MicrocksHttpPort) .WithEnvironment("ASYNC_MINION_URL", "http://microcks-async-minion:" + MicrocksAsyncMinionBuilder.MicrocksAsyncMinionHttpPort); @@ -218,7 +217,6 @@ public MicrocksContainerEnsemble WithAsyncFeature() } this._asyncMinionBuilder = new MicrocksAsyncMinionBuilder(this._network) - .WithEnvironment(MacOSHelper.GetJavaOptions()) .WithImage(image); if (this._debugLogLevelEnabled) diff --git a/tests/Microcks.Testcontainers.Tests/Helpers/MacOSHelperTests.cs b/tests/Microcks.Testcontainers.Tests/Helpers/MacOSHelperTests.cs deleted file mode 100644 index 74cf1ce..0000000 --- a/tests/Microcks.Testcontainers.Tests/Helpers/MacOSHelperTests.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright The Microcks Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// - -using Microcks.Testcontainers.Helpers; - -/// -/// Tests for . -/// Note: This is a temporary fix and should be removed in the near future. -/// -public class MacOSHelperTests -{ - [Fact] - public void GetJavaOptions_ShouldReturnOptions_WhenRunningOnMacOS() - { - // Arrange - MacOSHelper.IsMacOS = true; - // Act - var options = MacOSHelper.GetJavaOptions(); - - // Assert - Assert.NotEmpty(options); - Assert.Equal("-XX:UseSVE=0", options["JAVA_OPTIONS"]); - - } - - [Fact] - public void GetJavaOptions_ShouldReturnEmpty_WhenNotRunningOnMacOSA() - { - // Arrange - MacOSHelper.IsMacOS = false; - // Act - var options = MacOSHelper.GetJavaOptions(); - - // Assert - Assert.Empty(options); - } -} diff --git a/tests/Microcks.Testcontainers.Tests/MicrocksContractTestingFunctionalityWithOAuth2Tests.cs b/tests/Microcks.Testcontainers.Tests/MicrocksContractTestingFunctionalityWithOAuth2Tests.cs index dc7bf11..b95bcae 100644 --- a/tests/Microcks.Testcontainers.Tests/MicrocksContractTestingFunctionalityWithOAuth2Tests.cs +++ b/tests/Microcks.Testcontainers.Tests/MicrocksContractTestingFunctionalityWithOAuth2Tests.cs @@ -38,7 +38,6 @@ public MicrocksContractTestingFunctionalityWithOAuth2Tests(MicrocksContractTesti _fixture = fixture; var network = _fixture.Network; _keycloak = new KeycloakBuilder("quay.io/keycloak/keycloak:26.0.0") - .WithEnvironment(MacOSHelper.GetJavaOptions("JAVA_OPTS_APPEND")) .WithNetwork(network) .WithNetworkAliases("keycloak") .WithCommand("--import-realm")