diff --git a/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs b/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs index 1d1b1c7828..468ff45a62 100644 --- a/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs +++ b/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs @@ -117,6 +117,12 @@ private SampleProfile CaptureAndValidate(ITransactionProfilerFactory factory) [SkippableFact] public void Profiler_WithZeroStartupTimeout_CapturesAfterStartingAsynchronously() { + if (TestEnvironment.IsGitHubActions) + { + Skip.If(TestEnvironment.IsWinX64, "Flaky in CI on Windows X64."); + Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Flaky in CI on Linux."); + } + using var factory = new SamplingTransactionProfilerFactory(_testSentryOptions, TimeSpan.Zero); var profiler = factory.Start(new TransactionTracer(Substitute.For(), "test", ""), CancellationToken.None); Assert.Null(profiler); @@ -146,6 +152,8 @@ private void Profiler_SingleProfile_Works(int startTimeoutSeconds) [InlineData(10)] public void Profiler_MultipleProfiles_Works(int startTimeoutSeconds) { + Skip.If(TestEnvironment.IsGitHubActions, "Flaky in CI"); + using var factory = new SamplingTransactionProfilerFactory(_testSentryOptions, TimeSpan.FromSeconds(startTimeoutSeconds)); // in the async startup case, we need to wait before collecting if (startTimeoutSeconds == 0) diff --git a/test/Sentry.Testing/TestEnvironment.cs b/test/Sentry.Testing/TestEnvironment.cs index a674533ae1..1c2763b439 100644 --- a/test/Sentry.Testing/TestEnvironment.cs +++ b/test/Sentry.Testing/TestEnvironment.cs @@ -15,4 +15,7 @@ public static bool IsGitHubActions return isGitHubActions?.Equals("true", StringComparison.OrdinalIgnoreCase) == true; } } + + public static bool IsWinX64 => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + && RuntimeInformation.OSArchitecture == Architecture.X64; }