File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
src/QAToolKit.Engine.Probes.Test Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments