From 8ad6eeddd8ed0a0fd97fdd82cb4ee112e80df483 Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Thu, 1 Feb 2024 13:51:21 +1000 Subject: [PATCH] fix(configuration): allow ANY_SUCCESS and count sharding strategy with count 1 Closes #887 --- .../config/LogicalConfigurationValidator.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/configuration/src/main/kotlin/com/malinskiy/marathon/config/LogicalConfigurationValidator.kt b/configuration/src/main/kotlin/com/malinskiy/marathon/config/LogicalConfigurationValidator.kt index 4eb016dd3..1b6dab1b6 100644 --- a/configuration/src/main/kotlin/com/malinskiy/marathon/config/LogicalConfigurationValidator.kt +++ b/configuration/src/main/kotlin/com/malinskiy/marathon/config/LogicalConfigurationValidator.kt @@ -36,10 +36,15 @@ class LogicalConfigurationValidator : ConfigurationValidator { when(configuration.executionStrategy.mode) { ExecutionMode.ANY_SUCCESS -> { - if (configuration.shardingStrategy !is ShardingStrategyConfiguration.ParallelShardingStrategyConfiguration) { - throw ConfigurationException( - "Configuration is invalid: can't use complex sharding and any success execution strategy at the same time. Consult documentation for the any success execution logic" - ) + when(configuration.shardingStrategy) { + is ShardingStrategyConfiguration.CountShardingStrategyConfiguration -> { + if (configuration.shardingStrategy.count != 1) { + throw ConfigurationException( + "Configuration is invalid: can't use complex sharding and any success execution strategy at the same time. Consult documentation for the any success execution logic" + ) + } + } + else -> Unit } } ExecutionMode.ALL_SUCCESS -> {