Skip to content

Commit

Permalink
Update to include base test structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rtjd6554 committed Aug 6, 2024
1 parent 1262e9f commit 0818a57
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package sleeper.commit;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -31,10 +32,12 @@
import sleeper.core.record.process.RecordsProcessedSummary;
import sleeper.core.record.process.status.ProcessRun;
import sleeper.core.schema.Schema;
import sleeper.core.schema.type.StringType;
import sleeper.core.statestore.FileReference;
import sleeper.core.statestore.FileReferenceFactory;
import sleeper.core.statestore.ReplaceFileReferencesRequest;
import sleeper.core.statestore.StateStore;
import sleeper.core.statestore.commit.SplitPartitionCommitRequest;
import sleeper.core.statestore.commit.StateStoreCommitRequestInS3;
import sleeper.core.statestore.commit.StateStoreCommitRequestInS3SerDe;
import sleeper.core.statestore.exception.FileReferenceAssignedToJobException;
Expand Down Expand Up @@ -347,6 +350,39 @@ void shouldRefuseReferenceToS3HeldInS3() throws Exception {
}
}

@Nested
@DisplayName("Split partition commit request")
class SplitPartition {
Schema schema = schemaWithKey("key", new StringType());

@Test
@Disabled
void shouldApplySplitPartitionIntoTheStateStore() throws Exception {
PartitionsBuilder builder = new PartitionsBuilder(schema).rootFirst("root");

PartitionTree beforeTree = builder.buildTree();

PartitionTree afterTree = builder.splitToNewChildren("root", "left", "right", "aaa")
.buildTree();

// Given
StateStore stateStore = createTable("test-table");
FileReference outputFile = fileFactory.rootFile("output.parquet", 123L);
SplitPartitionCommitRequest commitRequest = new SplitPartitionCommitRequest("test-table",
afterTree.getPartition("root"),
afterTree.getPartition("left"),
afterTree.getPartition("right"));

// When
committer().apply(StateStoreCommitRequest.forSplitPartition(commitRequest));

// Then
//assertThat(stateStore.getFileReferences()).containsExactly(outputFile);
//assertThat(ingestJobStatusStore.getAllJobs("test-table")).isEmpty();

}
}

private StateStoreCommitter committer() {
return committerWithTimes(Instant::now);
}
Expand Down

0 comments on commit 0818a57

Please sign in to comment.