Skip to content

Commit 62d1e2b

Browse files
author
Zoran Cvetkov
committed
fix tests
1 parent 15411a1 commit 62d1e2b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

graph/src/components/store/entity_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl EntityCache {
364364
// check the validate for derived fields
365365
let is_valid = entity.validate(&key).is_ok();
366366

367-
//The next VID is based on a block number and a sequence withing the block
367+
// The next VID is based on a block number and a sequence within the block
368368
let vid = ((block as i64) << 32) + self.vid_seq as i64;
369369
self.vid_seq += 1;
370370
let entity = EntityV::new(entity, vid);

store/test-store/tests/postgres/writable.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use graph::blockchain::block_stream::{EntitySourceOperation, FirehoseCursor};
2+
use graph::data::store::EntityV;
23
use graph::data::subgraph::schema::DeploymentCreate;
34
use graph::data::value::Word;
45
use graph::data_source::CausalityRegion;
@@ -147,7 +148,7 @@ async fn insert_count(
147148
let entity_op = if block != 3 && block != 5 && block != 7 {
148149
EntityOperation::Set {
149150
key: count_key_local(&COUNTER_TYPE, &data.get("id").unwrap().to_string()),
150-
data,
151+
data: EntityV::new(data, block.into()),
151152
}
152153
} else {
153154
EntityOperation::Remove {
@@ -166,7 +167,7 @@ async fn insert_count(
166167
};
167168
let entity_op = EntityOperation::Set {
168169
key: count_key_local(&COUNTER2_TYPE, &data.get("id").unwrap().to_string()),
169-
data,
170+
data: EntityV::new(data, block.into()),
170171
};
171172
ops.push(entity_op);
172173
}
@@ -344,10 +345,10 @@ fn read_range_test() {
344345
r#"(1, [EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter), entity: Entity { count: Int(2), id: String("1") }, vid: 1 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(2), id: String("1") }, vid: 1 }])"#,
345346
r#"(2, [EntitySourceOperation { entity_op: Modify, entity_type: EntityType(Counter), entity: Entity { count: Int(4), id: String("1") }, vid: 2 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(4), id: String("2") }, vid: 2 }])"#,
346347
r#"(3, [EntitySourceOperation { entity_op: Delete, entity_type: EntityType(Counter), entity: Entity { count: Int(4), id: String("1") }, vid: 2 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(6), id: String("3") }, vid: 3 }])"#,
347-
r#"(4, [EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter), entity: Entity { count: Int(8), id: String("1") }, vid: 3 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(8), id: String("4") }, vid: 4 }])"#,
348-
r#"(5, [EntitySourceOperation { entity_op: Delete, entity_type: EntityType(Counter), entity: Entity { count: Int(8), id: String("1") }, vid: 3 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(10), id: String("5") }, vid: 5 }])"#,
349-
r#"(6, [EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter), entity: Entity { count: Int(12), id: String("1") }, vid: 4 }])"#,
350-
r#"(7, [EntitySourceOperation { entity_op: Delete, entity_type: EntityType(Counter), entity: Entity { count: Int(12), id: String("1") }, vid: 4 }])"#,
348+
r#"(4, [EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter), entity: Entity { count: Int(8), id: String("1") }, vid: 4 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(8), id: String("4") }, vid: 4 }])"#,
349+
r#"(5, [EntitySourceOperation { entity_op: Delete, entity_type: EntityType(Counter), entity: Entity { count: Int(8), id: String("1") }, vid: 4 }, EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter2), entity: Entity { count: Int(10), id: String("5") }, vid: 5 }])"#,
350+
r#"(6, [EntitySourceOperation { entity_op: Create, entity_type: EntityType(Counter), entity: Entity { count: Int(12), id: String("1") }, vid: 6 }])"#,
351+
r#"(7, [EntitySourceOperation { entity_op: Delete, entity_type: EntityType(Counter), entity: Entity { count: Int(12), id: String("1") }, vid: 6 }])"#,
351352
];
352353
let subgraph_store = store.subgraph_store();
353354
writable.deployment_synced().unwrap();

0 commit comments

Comments
 (0)