Skip to content

test with coyote #1019

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

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions Sentry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.EntityFramework.Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.EntityFramework", "samples\Sentry.Samples.EntityFramework\Sentry.Samples.EntityFramework.csproj", "{8E4BA4C7-413C-4668-8F41-32F484FFB7AA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Coyote.Tests", "test\Sentry.Coyote.Tests\Sentry.Coyote.Tests.csproj", "{04AEE2CC-AEEB-4810-A570-F992EEBB33FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -271,6 +273,10 @@ Global
{8E4BA4C7-413C-4668-8F41-32F484FFB7AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E4BA4C7-413C-4668-8F41-32F484FFB7AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E4BA4C7-413C-4668-8F41-32F484FFB7AA}.Release|Any CPU.Build.0 = Release|Any CPU
{04AEE2CC-AEEB-4810-A570-F992EEBB33FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04AEE2CC-AEEB-4810-A570-F992EEBB33FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04AEE2CC-AEEB-4810-A570-F992EEBB33FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04AEE2CC-AEEB-4810-A570-F992EEBB33FD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -314,6 +320,7 @@ Global
{8B38F62E-0DD5-486F-96F5-2025AFB9B491} = {AF6AF4C7-8AA2-4D59-8064-2D79560904EB}
{840B220E-68EC-4ECB-AEA1-67B0151F17FC} = {83263231-1A2A-4733-B759-EEFF14E8C5D5}
{8E4BA4C7-413C-4668-8F41-32F484FFB7AA} = {77454495-55EE-4B40-A089-71B9E8F82E89}
{04AEE2CC-AEEB-4810-A570-F992EEBB33FD} = {83263231-1A2A-4733-B759-EEFF14E8C5D5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0C652B1A-DF72-4EE5-A98B-194FE2C054F6}
Expand Down
1 change: 1 addition & 0 deletions src/Sentry/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[assembly: InternalsVisibleTo("Sentry.AspNetCore.Grpc.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010059964a931488bcdbd14657f1ee0df32df61b57b3d14d7290c262c2cc9ddaad6ec984044f761f778e1823049d2cb996a4f58c8ea5b46c37891414cb34b4036b1c178d7b582289d2eef3c0f1e9b692c229a306831ee3d371d9e883f0eb0f74aeac6c6ab8c85fd1ec04b267e15a31532c4b4e2191f5980459db4dce0081f1050fb8")]
[assembly: InternalsVisibleTo("Sentry.Extensions.Logging, PublicKey=002400000480000094000000060200000024000052534131000400000100010059964a931488bcdbd14657f1ee0df32df61b57b3d14d7290c262c2cc9ddaad6ec984044f761f778e1823049d2cb996a4f58c8ea5b46c37891414cb34b4036b1c178d7b582289d2eef3c0f1e9b692c229a306831ee3d371d9e883f0eb0f74aeac6c6ab8c85fd1ec04b267e15a31532c4b4e2191f5980459db4dce0081f1050fb8")]
[assembly: InternalsVisibleTo("Sentry.Extensions.Logging.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010059964a931488bcdbd14657f1ee0df32df61b57b3d14d7290c262c2cc9ddaad6ec984044f761f778e1823049d2cb996a4f58c8ea5b46c37891414cb34b4036b1c178d7b582289d2eef3c0f1e9b692c229a306831ee3d371d9e883f0eb0f74aeac6c6ab8c85fd1ec04b267e15a31532c4b4e2191f5980459db4dce0081f1050fb8")]
[assembly: InternalsVisibleTo("Sentry.Coyote.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010059964a931488bcdbd14657f1ee0df32df61b57b3d14d7290c262c2cc9ddaad6ec984044f761f778e1823049d2cb996a4f58c8ea5b46c37891414cb34b4036b1c178d7b582289d2eef3c0f1e9b692c229a306831ee3d371d9e883f0eb0f74aeac6c6ab8c85fd1ec04b267e15a31532c4b4e2191f5980459db4dce0081f1050fb8")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]

[assembly: CLSCompliant(true)]
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.2.7",
"commands": [
"coyote"
]
}
}
}
36 changes: 36 additions & 0 deletions test/Sentry.Coyote.Tests/BackgroundWorkerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Threading;
using Microsoft.Coyote.Tasks;
using Sentry.Extensibility;
using Sentry.Internal;
using Sentry.Internal.Http;
using Sentry.Protocol.Envelopes;

namespace Sentry.Coyote.Tests
{
public static class BackgroundWorkerTests
{
[Microsoft.Coyote.SystematicTesting.Test]
public static async Task EnqueueFlushAndDispose()
{
var options = new SentryOptions();
// TODO: SemaphoreSlim isn't rewritten yet: https://github.com/microsoft/coyote/issues/163
var bg = new BackgroundWorker(new CachingTransport(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();
}

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

<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp3.0;netcoreapp2.1;net462</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>

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

<ItemGroup>
<ProjectReference Include="../../src/Sentry/Sentry.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 @@
export COYOTE_CLI_TELEMETRY_OPTOUT=1
export tfm=net5.0
export configuration=Debug

dotnet build -c $configuration
# dotnet tool restore
dotnet tool run coyote rewrite bin/$configuration/$tfm/Sentry.dll
dotnet tool run coyote rewrite bin/$configuration/$tfm/Sentry.*.dll

dotnet tool run coyote test bin/$configuration/$tfm/Sentry.Coyote.Tests.dll --method EnqueueFlushAndDispose --iterations 10000``

# string name signing doesn't work on macOS
#COYOTE_CLI_TELEMETRY_OPTOUT=1 \
# dotnet tool run coyote rewrite bin/Debug/net5.0/Sentry.dll \
# --strong-name-key-file ../../.assets/Sentry.snk