Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test with coyote #2988

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions Sentry-CI-Build-Linux.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
"test\\Sentry.Coyote.Tests\\Sentry.Coyote.Tests.csproj",
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-Windows.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
"test\\Sentry.Coyote.Tests\\Sentry.Coyote.Tests.csproj",
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-macOS.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
"test\\Sentry.Coyote.Tests\\Sentry.Coyote.Tests.csproj",
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
Expand Down
7 changes: 7 additions & 0 deletions Sentry.NoMobile.sln
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastSerialization", "module
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.Console.Native", "samples\Sentry.Samples.Console.Native\Sentry.Samples.Console.Native.csproj", "{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Coyote.Tests", "test\Sentry.Coyote.Tests\Sentry.Coyote.Tests.csproj", "{79C0F367-CF2E-4021-B9FE-6912A61A1516}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -465,6 +467,10 @@ Global
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}.Release|Any CPU.Build.0 = Release|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -545,5 +551,6 @@ Global
{67269916-C417-4CEE-BD7D-CA66C3830AEE} = {A3CCA27E-4DF8-479D-833C-CAA0950715AA}
{8032310D-3C06-442C-A318-F365BCC4C804} = {A3CCA27E-4DF8-479D-833C-CAA0950715AA}
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2} = {21B42F60-5802-404E-90F0-AEBCC56760C0}
{79C0F367-CF2E-4021-B9FE-6912A61A1516} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D}
EndGlobalSection
EndGlobal
7 changes: 7 additions & 0 deletions Sentry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastSerialization", "module
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.Console.Native", "samples\Sentry.Samples.Console.Native\Sentry.Samples.Console.Native.csproj", "{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Coyote.Tests", "test\Sentry.Coyote.Tests\Sentry.Coyote.Tests.csproj", "{79C0F367-CF2E-4021-B9FE-6912A61A1516}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -465,6 +467,10 @@ Global
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2}.Release|Any CPU.Build.0 = Release|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79C0F367-CF2E-4021-B9FE-6912A61A1516}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -545,5 +551,6 @@ Global
{67269916-C417-4CEE-BD7D-CA66C3830AEE} = {A3CCA27E-4DF8-479D-833C-CAA0950715AA}
{8032310D-3C06-442C-A318-F365BCC4C804} = {A3CCA27E-4DF8-479D-833C-CAA0950715AA}
{FC8AEABA-1A40-4891-9EBA-4B6A1F7244B2} = {21B42F60-5802-404E-90F0-AEBCC56760C0}
{79C0F367-CF2E-4021-B9FE-6912A61A1516} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions SentryCore.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"samples\\Sentry.Samples.Console.Profiling\\Sentry.Samples.Console.Profiling.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Coyote.Tests\\Sentry.Coyote.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
1 change: 1 addition & 0 deletions SentryNoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
"test\\Sentry.Coyote.Tests\\Sentry.Coyote.Tests.csproj",
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions SentryNoSamples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
"test\\Sentry.Coyote.Tests\\Sentry.Coyote.Tests.csproj",
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions scripts/generate-solution-filters-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ filterConfigs:
- "**/Sentry.Profiling.csproj"
- "**/Sentry.csproj"
- "**/Sentry.Profiling.Tests.csproj"
- "**/Sentry.Coyote.Tests.csproj"
- "**/Sentry.Testing.csproj"
- "**/Sentry.Testing.CrashableApp.csproj"
- "**/Sentry.Tests.csproj"
Expand Down
1 change: 1 addition & 0 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<InternalsVisibleTo Include="Sentry.Serilog.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Testing" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Coyote.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions test/Sentry.Coyote.Tests/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"microsoft.coyote.cli": {
"version": "1.7.10",
"commands": [
"coyote"
]
}
}
}
35 changes: 35 additions & 0 deletions test/Sentry.Coyote.Tests/BackgroundWorkerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Sentry.Internal.Http;
using BackgroundWorker = Sentry.Internal.BackgroundWorker;

namespace Sentry.Coyote.Tests;

public static class BackgroundWorkerTests
{
[Microsoft.Coyote.SystematicTesting.Test]
public static async Task EnqueueFlushAndDisposeAsync()
{
var path = Path.Combine("envelopes", Guid.NewGuid().ToString());
var options = new SentryOptions
{
Dsn = "https://[email protected]/id",
CacheDirectoryPath = path,
};
var bg = new BackgroundWorker(CachingTransport.Create(new NoOpTransport(), options), options);

await bg.FlushAsync(TimeSpan.FromSeconds(3));
bg.EnqueueEnvelope(Envelope.FromEvent(new SentryEvent()));
bg.EnqueueEnvelope(Envelope.FromEvent(new SentryEvent()));
await bg.FlushAsync(TimeSpan.FromSeconds(3));
bg.EnqueueEnvelope(Envelope.FromEvent(new SentryEvent()));
bg.Dispose();
Directory.Delete(path);
}

private class NoOpTransport : ITransport
{
public System.Threading.Tasks.Task SendEnvelopeAsync(
Envelope envelope,
CancellationToken cancellationToken = default)
=> Task.CompletedTask;
}
}
18 changes: 18 additions & 0 deletions test/Sentry.Coyote.Tests/Sentry.Coyote.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Coyote" Version="1.7.10" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
<ProjectReference Include="..\Sentry.Testing\Sentry.Testing.csproj" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions test/Sentry.Coyote.Tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail

export COYOTE_CLI_TELEMETRY_OPTOUT=1
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
export configuration=Debug
export outputPath=bin/$configuration/coyote

dotnet build -c $configuration -o $outputPath

dotnet tool restore
dotnet tool run coyote rewrite $outputPath/Sentry.dll
dotnet tool run coyote rewrite $outputPath/Sentry.Testing.dll
dotnet tool run coyote rewrite $outputPath/Sentry.Coyote.Tests.dll

dotnet tool run coyote test $outputPath/Sentry.Coyote.Tests.dll --method EnqueueFlushAndDisposeAsync --iterations 10000
Loading