jakubzytka commented on code in PR #2336:
URL: https://github.com/apache/cassandra/pull/2336#discussion_r1195175787
##########
test/distributed/org/apache/cassandra/distributed/upgrade/UpgradeTestBase.java:
##########
@@ -176,83 +179,177 @@ public TestCase nodes(int nodeCount)
return this;
}
- /** performs all supported upgrade paths that exist in between from
and end on CURRENT (inclusive)
- * {@code upgradesToCurrentFrom(3.0); // produces: 3.0 -> CURRENT,
3.11 -> CURRENT, …}
- **/
- public TestCase upgradesToCurrentFrom(Semver from)
+ /**
+ * @param minimalSupportedVersion the minimal version that this test
case is applicable for
+ *
+ * This function sets the lower bound of test case's applicability
+ * the test case will run (see {@link #run}) all supported direct
upgrades source -> target
+ * such that:
+ * - source >= minimalSupportedVersion
+ * - source == CURRENT or target == CURRENT
+ *
+ * example:
+ * with CURRENT = v50 and minimalSupportedVersion = v30 the test case
will run:
+ * - v40 -> v50
+ * - v41 -> v50
+ * with CURRENT = v41 and minimalSupportedVersion = v30 the test case
will run:
+ * - v30 -> v41
+ * - v3x -> v41
+ * - v40 -> v41
+ * with CURRENT = v3x and minimalSupportedVersion = v30 the test case
will run:
+ * - v30 -> v3x
+ */
+ public TestCase minimalApplicableVersion(Semver
minimalSupportedVersion)
{
- return upgradesTo(from, CURRENT);
+ this.minimalApplicableVersion = minimalSupportedVersion;
+ addUpgrades();
+ return this;
}
/**
- * performs all supported upgrade paths to the "to" target; example
- * {@code upgradesTo(3.0, 4.0); // produces: 3.0 -> 4.0, 3.11 -> 4.0}
+ * @param minimalSupportedVersion the minimal version that this test
case is applicable for
+ * @param maximalSupportedVersion the maximal version that this test
case is applicable for
+ *
+ * This function sets both the lower and the upper bounds of test
case's applicability
+ * the test case will run (see {@link #run}) all supported direct
upgrades source -> target
+ * such that:
+ * - source >= minimalSupportedVersion
+ * - target <= maximalSupportedVersion
+ * - source == CURRENT or target == CURRENT
+ *
+ * example:
+ * with CURRENT = v50, minimalSupportedVersion = v30, and
maximalSupportedVersion = v41
+ * the test case will not run any upgrades.
+ * with CURRENT = v41, minimalSupportedVersion = v30, and
maximalSupportedVersion = v41
+ * the test case will run:
+ * - v30 -> v41
+ * - v3x -> v41
+ * - v40 -> v41
*/
- public TestCase upgradesTo(Semver from, Semver to)
+ public TestCase applicableVersionsRange(Semver
minimalSupportedVersion, Semver maximalSupportedVersion)
{
- List<TestVersions> upgrade = new ArrayList<>();
- NavigableSet<Semver> vertices =
sortedVertices(SUPPORTED_UPGRADE_PATHS);
- for (Semver start : vertices.subSet(from, true, to, false))
- {
- // only include pairs that are allowed, and start or end on
CURRENT
Review Comment:
The context of `contains` is not set, but range, because all this API works
on ranges (`updateFrom`, `updateTo` etc).
The natural way to express `contains` in set context is to use type system:
pass a set.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]