Skip to content

Commit

Permalink
[indexer-alt] Add tests for obj_info pruner (#20809)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] gRPC:
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
lxfind authored Jan 9, 2025
1 parent 22aedf0 commit 6c46c18
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 35 deletions.
12 changes: 6 additions & 6 deletions crates/sui-indexer-alt-framework/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl Indexer {
})
}

pub async fn new_for_testing() -> (Self, TempDb) {
pub async fn new_for_testing(migrations: &'static EmbeddedMigrations) -> (Self, TempDb) {
let temp_db = TempDb::new().unwrap();
let db_args = DbArgs::new_for_testing(temp_db.database().url().clone());
let indexer = Indexer::new(
Expand All @@ -188,7 +188,7 @@ impl Indexer {
local_ingestion_path: Some(tempdir().unwrap().into_path()),
},
IngestionConfig::default(),
&MIGRATIONS,
migrations,
CancellationToken::new(),
)
.await
Expand Down Expand Up @@ -500,7 +500,7 @@ mod tests {

#[tokio::test]
async fn test_add_new_pipeline() {
let (mut indexer, _temp_db) = Indexer::new_for_testing().await;
let (mut indexer, _temp_db) = Indexer::new_for_testing(&MIGRATIONS).await;
indexer
.concurrent_pipeline(ConcurrentPipeline1, ConcurrentConfig::default())
.await
Expand All @@ -510,7 +510,7 @@ mod tests {

#[tokio::test]
async fn test_add_existing_pipeline() {
let (mut indexer, _temp_db) = Indexer::new_for_testing().await;
let (mut indexer, _temp_db) = Indexer::new_for_testing(&MIGRATIONS).await;
let watermark = CommitterWatermark::new_for_testing(ConcurrentPipeline1::NAME, 10);
watermark
.update(&mut indexer.db().connect().await.unwrap())
Expand All @@ -525,7 +525,7 @@ mod tests {

#[tokio::test]
async fn test_add_multiple_pipelines() {
let (mut indexer, _temp_db) = Indexer::new_for_testing().await;
let (mut indexer, _temp_db) = Indexer::new_for_testing(&MIGRATIONS).await;
let watermark1 = CommitterWatermark::new_for_testing(ConcurrentPipeline1::NAME, 10);
watermark1
.update(&mut indexer.db().connect().await.unwrap())
Expand All @@ -551,7 +551,7 @@ mod tests {

#[tokio::test]
async fn test_add_multiple_pipelines_pruning_requires_processed_values() {
let (mut indexer, _temp_db) = Indexer::new_for_testing().await;
let (mut indexer, _temp_db) = Indexer::new_for_testing(&MIGRATIONS).await;
let watermark1 = CommitterWatermark::new_for_testing(ConcurrentPipeline1::NAME, 10);
watermark1
.update(&mut indexer.db().connect().await.unwrap())
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-indexer-alt-schema/src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum StoredCoinOwnerKind {
Consensus = 1,
}

#[derive(Insertable, Debug, Clone, FieldCount)]
#[derive(Insertable, Debug, Clone, FieldCount, Queryable)]
#[diesel(table_name = obj_info, primary_key(object_id, cp_sequence_number))]
#[diesel(treat_none_as_default_value = false)]
pub struct StoredObjInfo {
Expand Down
Loading

0 comments on commit 6c46c18

Please sign in to comment.