diff --git a/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java b/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java index cf80b64e25ac..dc34c8cdf0d1 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java @@ -123,10 +123,6 @@ private DistributedQueryRunner( { requireNonNull(defaultSession, "defaultSession is null"); - if (backupCoordinatorProperties.isPresent()) { - checkArgument(nodeCount >= 2, "the nodeCount must be greater than or equal to two!"); - } - setupLogging(); try { @@ -137,7 +133,9 @@ private DistributedQueryRunner( registerNewWorker = () -> createServer(false, extraProperties, environment, additionalModule, baseDataDir, ImmutableList.of(), ImmutableList.of()); - for (int i = backupCoordinatorProperties.isEmpty() ? 1 : 2; i < nodeCount; i++) { + int coordinatorCount = backupCoordinatorProperties.isEmpty() ? 1 : 2; + checkArgument(nodeCount >= coordinatorCount, "nodeCount includes coordinator(s) count, so must be at least %s, got: %s", coordinatorCount, nodeCount); + for (int i = coordinatorCount; i < nodeCount; i++) { registerNewWorker.run(); }