Skip to content

Commit 6158200

Browse files
committed
Fix getCcmVersionString() for X.Y.0-rcZ Scylla
After scylladb/scylla-machine-image#359 was merged, naming of RC versions of Scylla was changed from X.Y.rcZ to X.Y.0-rcZ. However, getCcmVersionString still produced the version numbers in X.Y.rcZ format. Fix this issue by checking whether a modern Scylla version is tested and if not, perform a string replacement in version number. In the previous version of the code it seems like there was a mistake, as it would incorrectly produce version numbers such as X.Y-rcZ instead of X.Y.rcZ.
1 parent 13c9e4b commit 6158200

File tree

1 file changed

+11
-7
lines changed
  • test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm

1 file changed

+11
-7
lines changed

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,19 @@ public Version getCassandraVersion() {
244244

245245
private String getCcmVersionString(Version version) {
246246
if (SCYLLA_ENABLEMENT) {
247-
// It seems that Scylla versions like 5.0-rc2 cannot be passed to CCM create options as
248-
// 5.0.0-rc2,
249-
// so we remove patch number from here.
250-
// Likewise, 2022.1.0-rc8 will be returned as 2022.1.rc8
247+
// Scylla OSS versions before 5.1 had RC versioning scheme of 5.0.rc3.
248+
// Scylla OSS versions after (and including 5.1) have RC versioning of 5.1.0-rc3.
249+
// A similar situation occurs with Scylla Enterprise after 2022.2.
250+
//
251+
// CcmBridge parses the version numbers to a newer format (5.1.0-rc3), so a replacement
252+
// must be performed for older Scylla version numbers.
251253
String versionString = version.toString();
252-
if (String.valueOf(version.getMajor()).matches("\\d{4}")) {
254+
255+
boolean shouldReplace =
256+
(SCYLLA_ENTERPRISE && version.compareTo(Version.parse("2022.2.0-rc0")) < 0)
257+
|| (!SCYLLA_ENTERPRISE && version.compareTo(Version.parse("5.1.0-rc0")) < 0);
258+
if (shouldReplace) {
253259
versionString = versionString.replace(".0-", ".");
254-
} else {
255-
versionString = versionString.replace(".0-", "-");
256260
}
257261
return "release:" + versionString;
258262
}

0 commit comments

Comments
 (0)