Skip to content

Commit 1bdc0b3

Browse files
committed
Update testng to 6.14.3
This version has bug when `SkipException` in TestListener leads to test being marked as `FAILED`. To workaround this issue TestListener has to set status specifically.
1 parent d71294e commit 1bdc0b3

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed

Makefile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
SHELL := bash
2+
DEBUG ?= false
3+
DRY_RUN ?= true
4+
SKIP_TESTS ?= false
5+
GITHUB_STEP_SUMMARY ?=
6+
SCYLLA_VERSION ?= release:2025.3
7+
CASSANDRA_VERSION ?= cassanra:5
8+
9+
#ifeq ($(shell if [[ -n "$${GITHUB_STEP_SUMMARY}" ]]; then echo "running-in-workflow"; else echo "running-in-shell"; fi), running-in-workflow)
10+
# DEBUG = true
11+
#endif
12+
13+
ifneq (${GITHUB_STEP_SUMMARY},)
14+
DEBUG = true
15+
endif
16+
17+
_RELEASE_PUBLISH ?=
18+
ifneq (${DRY_RUN},true)
19+
_RELEASE_PUBLISH= -Drelease.autopublish=true
20+
endif
21+
22+
_RELEASE_SKIP_TESTS ?=
23+
ifneq (${SKIP_TESTS},false)
24+
_RELEASE_SKIP_TESTS= -DskipTests=true -DskipITs=true
25+
endif
26+
27+
ifeq (${DEBUG},false)
28+
MVNCMD ?= mvn
29+
else
30+
MVNCMD ?= mvn -B -X -ntp
31+
endif
32+
33+
fmt:
34+
$(MVNCMD) fmt:format
35+
36+
compile:
37+
$(MVNCMD) compile test-compile -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
38+
39+
verify:
40+
$(MVNCMD) verify -DskipTests
41+
42+
test-unit:
43+
$(MVNCMD) test -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
44+
45+
test-integration-scylla:
46+
mvn -Dsurefire.failIfNoSpecifiedTests=false -Dtest=should_stop_if_cancelled_between_attempts -B verify -Pshort -Dscylla.version=$(SCYLLA_VERSION) -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
47+
48+
test-integration-cassandra:
49+
mvn -Dsurefire.failIfNoSpecifiedTests=false -Dtest=should_stop_if_cancelled_between_attempts -B verify -Pshort -Dcassandra.version=$(CASSANDRA_VERSION) -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
50+
51+
test: fmt compile verify test-unit
52+
53+
release-prepare:
54+
ifeq ($(shell if [[ -n "$${GPG_PASSPHRASE}" ]]; then echo "present"; else echo "absent"; fi), absent)
55+
@echo "environment variable GPG_PASSPHRASE has to be set"
56+
@exit 1
57+
endif
58+
MAVEN_OPTS="$${MAVEN_OPTS}$(_RELEASE_SKIP_TESTS)" $(MVNCMD) release:prepare -Drelease.push.changes=false -Dgpg.passphrase=$${GPG_PASSPHRASE}
59+
60+
.release:
61+
ifeq ($(shell if [[ -n "$${GPG_PASSPHRASE}" ]]; then echo "present"; else echo "absent"; fi), absent)
62+
@echo "environment variable GPG_PASSPHRASE has to be set"
63+
@exit 1
64+
endif
65+
ifeq ($(shell if [[ -n "$${SONATYPE_TOKEN_USERNAME}" ]]; then echo "present"; else echo "absent"; fi), absent)
66+
@echo "environment variable SONATYPE_TOKEN_USERNAME has to be set"
67+
@exit 1
68+
endif
69+
ifeq ($(shell if [[ -n "$${SONATYPE_TOKEN_PASSWORD}" ]]; then echo "present"; else echo "absent"; fi), absent)
70+
@echo "environment variable SONATYPE_TOKEN_PASSWORD has to be set"
71+
@exit 1
72+
endif
73+
MAVEN_OPTS="$${MAVEN_OPTS}$(_RELEASE_SKIP_TESTS)" $(MVNCMD) release:perform -Dgpg.passphrase=$${GPG_PASSPHRASE} $(_RELEASE_PUBLISH)
74+
75+
release:
76+
$(MAKE) .release DRY_RUN=false
77+
78+
release-dry-run:
79+
$(MAKE) .release DRY_RUN=true
80+
81+

driver-core/src/test/java/com/datastax/driver/core/TestListener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ public void beforeInvocation(IInvokedMethod testMethod, ITestResult testResult)
123123
Method method = constructorOrMethod.getMethod();
124124
if (method != null) {
125125
scanAnnotatedElement(method);
126+
try {
127+
scanAnnotatedElement(method);
128+
} catch (SkipException e) {
129+
// There is a bug in testng 6.14.3 when `SkipException` marks test as failed.
130+
// To work it around we set test status beforehand.
131+
testResult.setStatus(ITestResult.SKIP);
132+
throw e;
133+
}
126134
}
127135
}
128136

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<!-- more recent versions of pax-exam require JDK7+ -->
8080
<pax-exam.version>3.6.0</pax-exam.version>
8181
<url.version>2.4.0</url.version>
82-
<testng.version>6.8.8</testng.version>
82+
<testng.version>6.14.3</testng.version>
8383
<assertj.version>1.7.0</assertj.version>
8484
<mockito.version>1.10.8</mockito.version>
8585
<wiremock.version>2.25.0</wiremock.version>

0 commit comments

Comments
 (0)