Skip to content

Commit 57c41fa

Browse files
committed
ignore fact on github
1 parent 4621318 commit 57c41fa

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using Xunit;
3+
4+
namespace QAToolKit.Engine.Probes.Test
5+
{
6+
public class IgnoreOnGithubFact : FactAttribute
7+
{
8+
public IgnoreOnGithubFact()
9+
{
10+
if (IsGitHubAction())
11+
{
12+
Skip = "Ignore the test when run in Github agent.";
13+
}
14+
}
15+
16+
private static bool IsGitHubAction()
17+
=> Environment.GetEnvironmentVariable("GITHUB_ACTION") != null;
18+
}
19+
}

src/QAToolKit.Engine.Probes.Test/Probes/PingProbeTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ public PingProbeTests(ITestOutputHelper testOutputHelper)
2020
_logger = loggerFactory.CreateLogger<PingProbeTests>();
2121
}
2222

23-
[Fact]
23+
[IgnoreOnGithubFact]
2424
public async Task PingHostNameTest_Success()
2525
{
2626
var pinger = new PingProbe("52.217.36.203", 500);
2727
var result = await pinger.Execute();
2828

29-
_logger.LogInformation($"Success: {result.Success}");
30-
_logger.LogInformation($"ReplyAddress: {result.ReplyAddress}");
31-
_logger.LogInformation($"Time: {result.RoundTripTime}");
32-
_logger.LogInformation($"TTL: {result.Ttl}");
33-
_logger.LogInformation($"BufferLength: {result.BufferLength}");
29+
Assert.Equal(IPStatus.Success, result.Success);
30+
}
31+
32+
[IgnoreOnGithubFact]
33+
public async Task PingParseIPTest_Success()
34+
{
35+
var pinger = new PingProbe(IPAddress.Parse("52.217.36.203"), 500);
36+
var result = await pinger.Execute();
3437

3538
Assert.Equal(IPStatus.Success, result.Success);
3639
}

0 commit comments

Comments
 (0)