Skip to content

Commit

Permalink
trying to find stuck test
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Dec 10, 2023
1 parent 0c4ebc3 commit 45617e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/device-tests-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ jobs:
continue-on-error: true
run: pwsh scripts/device-test.ps1 ios -Run

- name: Retry Tests (if previous failed to run)
if: steps.first-run.outcome == 'failure'
run: pwsh scripts/device-test.ps1 ios -Run
# - name: Retry Tests (if previous failed to run)
# if: steps.first-run.outcome == 'failure'
# run: pwsh scripts/device-test.ps1 ios -Run

- name: Upload results
if: success() || failure()
Expand Down
10 changes: 6 additions & 4 deletions scripts/parse-xunit2-xml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ElementText([System.Xml.XmlElement] $element)
$summary = "## Summary`n`n"
$summary += "| Assembly | Passed | Failed | Skipped |`n"
$summary += "| -------- | -----: | -----: | ------: |`n"
$failures = ""
$failures = ''
foreach ($assembly in $xml.assemblies.assembly)
{
$summary += "| $($assembly.name) | $($assembly.passed) | $($assembly.failed) | $($assembly.skipped) |`n"
Expand All @@ -30,23 +30,25 @@ foreach ($assembly in $xml.assemblies.assembly)
$failures += "### $($assembly.name)`n"
foreach ($test in $assembly.collection.test)
{
if ($test.result -eq "Pass")
if ($test.result -eq 'Pass')
{
continue
}

$failures += "#### $($test.name.Replace('\"', '"'))"
if ($test.result -eq "Skip")
if ($test.result -eq 'Skip')
{
$failures += " - Skipped`n"
$failures += "$(ElementText $test.reason)"
}
else
{
$failures += " - $($test.result)ed`n"
if ($test.PSobject.Properties.name -match "output")
if ($test.PSobject.Properties.name -match 'output')
{
$failures += '```' + "`n"
$failures += "$(ElementText $test.output)`n"
$failures += '```'
}
$failures += '```' + "`n"
$failures += "$(ElementText $test.failure.message)`n"
Expand Down
23 changes: 12 additions & 11 deletions test/Sentry.Tests/HubTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private class Fixture
{
public SentryOptions Options { get; }

public ISentryClient Client { get; set; }
public ISentryClient Client { get; set; }

public ISessionManager SessionManager { get; set; }

Expand Down Expand Up @@ -948,7 +948,7 @@ public void ContinueTrace_ReceivesHeadersAsStrings_SetsPropagationContextAndRetu
SentryId.Parse("43365712692146d08ee11a729dfbcaca"), SpanId.Parse("1000000000000000"));
hub.ConfigureScope(scope => scope.PropagationContext = propagationContext);
var traceHeader = "5bd5f6d346b442dd9177dce9302fd737-2000000000000000";
var baggageHeader ="sentry-trace_id=5bd5f6d346b442dd9177dce9302fd737, sentry-public_key=49d0f7386ad645858ae85020e393bef3, sentry-sample_rate=1.0";
var baggageHeader = "sentry-trace_id=5bd5f6d346b442dd9177dce9302fd737, sentry-public_key=49d0f7386ad645858ae85020e393bef3, sentry-sample_rate=1.0";

hub.ConfigureScope(scope => scope.PropagationContext.TraceId.Should().Be("43365712692146d08ee11a729dfbcaca")); // Sanity check

Expand Down Expand Up @@ -991,7 +991,7 @@ private class ThrowingProfilerFactory : ITransactionProfilerFactory

internal class ThrowingProfiler : ITransactionProfiler
{
public void Finish() {}
public void Finish() { }

public Sentry.Protocol.Envelopes.ISerializable Collect(Transaction _) => throw new Exception("test");
}
Expand All @@ -1003,7 +1003,7 @@ private class AsyncThrowingProfilerFactory : ITransactionProfilerFactory

internal class AsyncThrowingProfiler : ITransactionProfiler
{
public void Finish() {}
public void Finish() { }

public Sentry.Protocol.Envelopes.ISerializable Collect(Transaction transaction)
=> AsyncJsonSerializable.CreateFrom(CollectAsync(transaction));
Expand All @@ -1021,15 +1021,15 @@ private class TestProfilerFactory : ITransactionProfilerFactory

internal class TestProfiler : ITransactionProfiler
{
public void Finish() {}
public void Finish() { }

public Sentry.Protocol.Envelopes.ISerializable Collect(Transaction _) => new JsonSerializable(new ProfileInfo());
}

#nullable disable

[Fact]
public void CaptureTransaction_WithSyncThrowingTransactionProfiler_DoesntSendTransaction()
public async Task CaptureTransaction_WithSyncThrowingTransactionProfiler_DoesntSendTransaction()
{
// Arrange
var transport = new FakeTransport();
Expand All @@ -1045,13 +1045,14 @@ public void CaptureTransaction_WithSyncThrowingTransactionProfiler_DoesntSendTra

// Act
hub.StartTransaction("foo", "bar").Finish();
await hub.FlushAsync();

// Assert
transport.GetSentEnvelopes().Should().BeEmpty();
}

[Fact]
public void CaptureTransaction_WithAsyncThrowingTransactionProfiler_SendsTransactionWithoutProfile()
public async Task CaptureTransaction_WithAsyncThrowingTransactionProfiler_SendsTransactionWithoutProfile()
{
// Arrange
var transport = new FakeTransport();
Expand All @@ -1069,7 +1070,7 @@ public void CaptureTransaction_WithAsyncThrowingTransactionProfiler_SendsTransac

// Act
hub.StartTransaction("foo", "bar").Finish();
hub.FlushAsync().Wait();
await hub.FlushAsync();

// Assert
transport.GetSentEnvelopes().Should().HaveCount(1);
Expand All @@ -1088,7 +1089,7 @@ public void CaptureTransaction_WithAsyncThrowingTransactionProfiler_SendsTransac
}

[Fact]
public void CaptureTransaction_WithTransactionProfiler_SendsTransactionWithProfile()
public async Task CaptureTransaction_WithTransactionProfiler_SendsTransactionWithProfile()
{
// Arrange
var transport = new FakeTransport();
Expand All @@ -1106,7 +1107,7 @@ public void CaptureTransaction_WithTransactionProfiler_SendsTransactionWithProfi

// Act
hub.StartTransaction("foo", "bar").Finish();
hub.FlushAsync().Wait();
await hub.FlushAsync();

// Assert
transport.GetSentEnvelopes().Should().HaveCount(1);
Expand Down Expand Up @@ -1452,7 +1453,7 @@ public void CaptureTransaction_HubEnabled(bool enabled)
transaction.Finish();

// Assert
_fixture.Client.Received().CaptureTransaction(Arg.Is<Transaction>(t => t.IsSampled == enabled),Arg.Any<Scope>(), Arg.Any<Hint>());
_fixture.Client.Received().CaptureTransaction(Arg.Is<Transaction>(t => t.IsSampled == enabled), Arg.Any<Scope>(), Arg.Any<Hint>());
}

[Fact]
Expand Down

0 comments on commit 45617e7

Please sign in to comment.