Commit f8d722e 1 parent 69dc232 commit f8d722e Copy full SHA for f8d722e
File tree 4 files changed +20
-6
lines changed
testng-core/src/test/java/test
testng-test-osgi/src/test/java/org/testng/test/osgi
4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,9 @@ public void flakyTest() {
23
23
}
24
24
}
25
25
26
- @ Test (timeOut = 2 , priority = 4 )
26
+ @ Test (timeOut = 25 , priority = 4 )
27
27
public void timingOutTest () throws InterruptedException {
28
- TimeUnit .MILLISECONDS .sleep (10 );
28
+ TimeUnit .SECONDS .sleep (10 );
29
+ Assert .fail ();
29
30
}
30
31
}
Original file line number Diff line number Diff line change @@ -37,9 +37,17 @@ public void anotherSampleTest() {
37
37
38
38
private void sleepSilently () {
39
39
try {
40
- TimeUnit .MILLISECONDS .sleep (500 * random . nextInt ( 10 ));
40
+ TimeUnit .MILLISECONDS .sleep (500 * random ( ));
41
41
} catch (InterruptedException e ) {
42
42
Thread .currentThread ().interrupt ();
43
43
}
44
44
}
45
+
46
+ private static long random () {
47
+ int value = random .nextInt (10 );
48
+ if (value == 0 ) {
49
+ return 1 ;
50
+ }
51
+ return value ;
52
+ }
45
53
}
Original file line number Diff line number Diff line change @@ -40,17 +40,20 @@ public void testSuiteLevelParallelMode() {
40
40
String allTimeStamps =
41
41
keyset .stream ().map (Objects ::toString ).collect (Collectors .joining ("," ));
42
42
long prev = keyset .get (0 );
43
+ int permissibleLag = 40 ;
43
44
for (int i = 1 ; i < keyset .size (); i ++) {
44
45
long current = keyset .get (i );
45
46
long diff = current - prev ;
46
47
Assertions .assertThat (diff )
47
48
.withFailMessage (
48
- "Test methods should have started within a lag of max 40 ms but it was "
49
+ "Test methods should have started within a lag of max "
50
+ + permissibleLag
51
+ + " ms but it was "
49
52
+ diff
50
53
+ " ms ["
51
54
+ allTimeStamps
52
55
+ "]" )
53
- .isLessThanOrEqualTo (40 );
56
+ .isLessThanOrEqualTo (permissibleLag );
54
57
prev = current ;
55
58
}
56
59
}
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ public Option[] config() {
25
25
return options (defaultTestngOsgiOptions ());
26
26
}
27
27
28
- @ Test
28
+ // TODO: Enable this test once the PR https://github.com/ops4j/org.ops4j.pax.exam2/pull/1112
29
+ // gets merged and there's a new release done.
30
+ @ Test (enabled = false )
29
31
public void versionShouldStartWithDigit () throws Exception {
30
32
Class <?> versionClass = Class .forName ("org.testng.internal.Version" );
31
33
Method getVersionStringMethod = versionClass .getMethod ("getVersionString" );
You can’t perform that action at this time.
0 commit comments