Skip to content

Commit

Permalink
Tidy DynamoDBStateStoreIT and DynamoDBStateStoreMultipleTablesIT
Browse files Browse the repository at this point in the history
  • Loading branch information
patchwork01 committed Sep 28, 2023
1 parent 708ec48 commit c8d778e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private DynamoDBStateStore getStateStore(Schema schema,
List<Partition> partitions,
int garbageCollectorDelayBeforeDeletionInMinutes) throws StateStoreException {
TableProperties tableProperties = createTestTableProperties(instanceProperties, schema);
tableProperties.set(GARBAGE_COLLECTOR_DELAY_BEFORE_DELETION, String.valueOf(garbageCollectorDelayBeforeDeletionInMinutes));
tableProperties.setNumber(GARBAGE_COLLECTOR_DELAY_BEFORE_DELETION, garbageCollectorDelayBeforeDeletionInMinutes);
DynamoDBStateStore stateStore = new DynamoDBStateStore(instanceProperties, tableProperties, dynamoDBClient);
stateStore.initialise(partitions);
return stateStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import sleeper.configuration.properties.instance.InstanceProperties;
import sleeper.core.CommonTestConstants;
import sleeper.core.partition.PartitionTree;
import sleeper.core.partition.PartitionsBuilder;
import sleeper.core.schema.Schema;
import sleeper.core.schema.type.LongType;
import sleeper.core.statestore.FileInfo;
import sleeper.core.statestore.FileInfoFactory;
import sleeper.core.statestore.StateStore;
import sleeper.dynamodb.tools.DynamoDBContainer;
import sleeper.statestore.StateStoreFactory;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -46,19 +45,17 @@

@Testcontainers
public class DynamoDBStateStoreMultipleTablesIT {
private static final int DYNAMO_PORT = 8000;
private static AmazonDynamoDB dynamoDBClient;
@Container
public static GenericContainer dynamoDb = new GenericContainer(CommonTestConstants.DYNAMODB_LOCAL_CONTAINER)
.withExposedPorts(DYNAMO_PORT);
public static DynamoDBContainer dynamoDb = new DynamoDBContainer();
private final InstanceProperties instanceProperties = createTestInstanceProperties();
private final Schema schema = schemaWithKey("key", new LongType());
private final StateStoreFactory stateStoreFactory = new StateStoreFactory(dynamoDBClient, instanceProperties, new Configuration());
private final FileInfoFactory fileInfoFactory = fileInfoFactory(new PartitionsBuilder(schema).singlePartition("root").buildTree());

@BeforeAll
public static void initDynamoClient() {
dynamoDBClient = buildAwsV1Client(dynamoDb, DYNAMO_PORT, AmazonDynamoDBClientBuilder.standard());
dynamoDBClient = buildAwsV1Client(dynamoDb, dynamoDb.getDynamoPort(), AmazonDynamoDBClientBuilder.standard());
}

@AfterAll
Expand Down

0 comments on commit c8d778e

Please sign in to comment.