diff --git a/client-dynamodb-v2/src/main/kotlin/app/cash/backfila/client/dynamodbv2/internal/DynamoDbBackfillOperator.kt b/client-dynamodb-v2/src/main/kotlin/app/cash/backfila/client/dynamodbv2/internal/DynamoDbBackfillOperator.kt index 2886e5273..8e65e61fc 100644 --- a/client-dynamodb-v2/src/main/kotlin/app/cash/backfila/client/dynamodbv2/internal/DynamoDbBackfillOperator.kt +++ b/client-dynamodb-v2/src/main/kotlin/app/cash/backfila/client/dynamodbv2/internal/DynamoDbBackfillOperator.kt @@ -29,6 +29,11 @@ class DynamoDbBackfillOperator( val config = parametersOperator.constructBackfillConfig(request) backfill.validate(config) + require( + request.range == null || + (request.range.start == null && request.range.end == null), + ) { "Range is not supported for this Dynamo Backfila client" } + var table = dynamoDbClient.describeTable { it.tableName(backfill.dynamoDbTable.tableName()) }.table() diff --git a/client-dynamodb-v2/src/test/kotlin/app/cash/backfila/client/dynamodbv2/DynamoDbBackfillTest.kt b/client-dynamodb-v2/src/test/kotlin/app/cash/backfila/client/dynamodbv2/DynamoDbBackfillTest.kt index 36da3f829..352c2db1f 100644 --- a/client-dynamodb-v2/src/test/kotlin/app/cash/backfila/client/dynamodbv2/DynamoDbBackfillTest.kt +++ b/client-dynamodb-v2/src/test/kotlin/app/cash/backfila/client/dynamodbv2/DynamoDbBackfillTest.kt @@ -59,6 +59,23 @@ class DynamoDbBackfillTest { }.hasMessageContaining("Validate failed") } + @Test + fun `adding a range fails creation`() { + testData.addThriller() + + assertThatCode { + backfila.createWetRun(rangeStart = "start") + }.hasMessageContaining("Range is not supported for this Dynamo Backfila client") + + assertThatCode { + backfila.createWetRun(rangeEnd = "end") + }.hasMessageContaining("Range is not supported for this Dynamo Backfila client") + + assertThatCode { + backfila.createWetRun(rangeStart = "start", rangeEnd = "end") + }.hasMessageContaining("Range is not supported for this Dynamo Backfila client") + } + class MakeTracksExplicitBackfill @Inject constructor( dynamoDb: DynamoDbClient, private val dynamoDbEnhancedClient: DynamoDbEnhancedClient, diff --git a/client-dynamodb/build.gradle.kts b/client-dynamodb/build.gradle.kts index 96f0b319d..6e1a80970 100644 --- a/client-dynamodb/build.gradle.kts +++ b/client-dynamodb/build.gradle.kts @@ -36,6 +36,12 @@ dependencies { testImplementation(project(":backfila-embedded")) testImplementation(project(":client-testing")) + if (org.apache.tools.ant.taskdefs.condition.Os.isArch("aarch64")) { + // Without this, we can't compile on Apple Silicon currently. This is likely not necessary to + // have longterm, so we should remove it when platform fixes things across Square. + testImplementation("io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392") + } + // **************************************** // For TESTING purposes only. We only want Misk for easy testing. // DO NOT turn these into regular dependencies. diff --git a/client-dynamodb/src/main/kotlin/app/cash/backfila/client/dynamodb/internal/DynamoDbBackfillOperator.kt b/client-dynamodb/src/main/kotlin/app/cash/backfila/client/dynamodb/internal/DynamoDbBackfillOperator.kt index e6b76b886..19f9e3c2e 100644 --- a/client-dynamodb/src/main/kotlin/app/cash/backfila/client/dynamodb/internal/DynamoDbBackfillOperator.kt +++ b/client-dynamodb/src/main/kotlin/app/cash/backfila/client/dynamodb/internal/DynamoDbBackfillOperator.kt @@ -28,6 +28,11 @@ class DynamoDbBackfillOperator( val config = parametersOperator.constructBackfillConfig(request) backfill.validate(config) + require( + request.range == null || + (request.range.start == null && request.range.end == null), + ) { "Range is not supported for this Dynamo Backfila client" } + val tableMapper = dynamoDb.newTableMapper(backfill.itemType.java) val tableDescription = tableMapper.describeTable() if (backfill.mustHaveProvisionedBillingMode()) { diff --git a/client-dynamodb/src/test/kotlin/app/cash/backfila/client/dynamodb/DynamoDbBackfillTest.kt b/client-dynamodb/src/test/kotlin/app/cash/backfila/client/dynamodb/DynamoDbBackfillTest.kt index d710be14d..79d2b07b8 100644 --- a/client-dynamodb/src/test/kotlin/app/cash/backfila/client/dynamodb/DynamoDbBackfillTest.kt +++ b/client-dynamodb/src/test/kotlin/app/cash/backfila/client/dynamodb/DynamoDbBackfillTest.kt @@ -53,6 +53,23 @@ class DynamoDbBackfillTest { }.hasMessageContaining("Validate failed") } + @Test + fun `adding a range fails creation`() { + testData.addThriller() + + assertThatCode { + backfila.createWetRun(rangeStart = "start") + }.hasMessageContaining("Range is not supported for this Dynamo Backfila client") + + assertThatCode { + backfila.createWetRun(rangeEnd = "end") + }.hasMessageContaining("Range is not supported for this Dynamo Backfila client") + + assertThatCode { + backfila.createWetRun(rangeStart = "start", rangeEnd = "end") + }.hasMessageContaining("Range is not supported for this Dynamo Backfila client") + } + class MakeTracksExplicitBackfill @Inject constructor( dynamoDb: DynamoDBMapper, ) : UpdateInPlaceDynamoDbBackfill(dynamoDb) {