Skip to content

Commit a83233b

Browse files
author
Zoran Cvetkov
committed
fix more tests
1 parent 1c80b76 commit a83233b

File tree

5 files changed

+84
-43
lines changed

5 files changed

+84
-43
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ async fn insert_test_data(store: Arc<dyn WritableStore>, deployment: DeploymentL
125125

126126
let ts64 = TIMES[0];
127127
let entities = vec![
128-
entity! { schema => id: 1i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(1), amount: bd(10) },
129-
entity! { schema => id: 2i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(1), amount: bd(1) },
128+
entity! { schema => id: 1i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(1), amount: bd(10), vid: 11i64 },
129+
entity! { schema => id: 2i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(1), amount: bd(1), vid: 12i64 },
130130
];
131131

132132
insert(&store, &deployment, BLOCKS[0].clone(), TIMES[0], entities)
@@ -135,26 +135,26 @@ async fn insert_test_data(store: Arc<dyn WritableStore>, deployment: DeploymentL
135135

136136
let ts64 = TIMES[1];
137137
let entities = vec![
138-
entity! { schema => id: 11i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(2), amount: bd(2) },
139-
entity! { schema => id: 12i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(2), amount: bd(20) },
138+
entity! { schema => id: 11i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(2), amount: bd(2), vid: 21i64 },
139+
entity! { schema => id: 12i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(2), amount: bd(20), vid: 22i64 },
140140
];
141141
insert(&store, &deployment, BLOCKS[1].clone(), TIMES[1], entities)
142142
.await
143143
.unwrap();
144144

145145
let ts64 = TIMES[2];
146146
let entities = vec![
147-
entity! { schema => id: 21i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(3), amount: bd(30) },
148-
entity! { schema => id: 22i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(3), amount: bd(3) },
147+
entity! { schema => id: 21i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(3), amount: bd(30), vid: 31i64 },
148+
entity! { schema => id: 22i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(3), amount: bd(3), vid: 32i64 },
149149
];
150150
insert(&store, &deployment, BLOCKS[2].clone(), TIMES[2], entities)
151151
.await
152152
.unwrap();
153153

154154
let ts64 = TIMES[3];
155155
let entities = vec![
156-
entity! { schema => id: 31i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(4), amount: bd(4) },
157-
entity! { schema => id: 32i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(4), amount: bd(40) },
156+
entity! { schema => id: 31i64, timestamp: ts64, token: TOKEN1.clone(), price: bd(4), amount: bd(4), vid: 41i64 },
157+
entity! { schema => id: 32i64, timestamp: ts64, token: TOKEN2.clone(), price: bd(4), amount: bd(40), vid: 42i64 },
158158
];
159159
insert(&store, &deployment, BLOCKS[3].clone(), TIMES[3], entities)
160160
.await

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ async fn insert_test_data(store: Arc<DieselSubgraphStore>) -> DeploymentLocator
175175
184.4,
176176
false,
177177
None,
178+
0,
178179
);
179180
transact_entity_operations(&store, &deployment, BLOCKS[0].clone(), vec![test_entity_1])
180181
.await
@@ -189,6 +190,7 @@ async fn insert_test_data(store: Arc<DieselSubgraphStore>) -> DeploymentLocator
189190
159.1,
190191
true,
191192
Some("red"),
193+
1,
192194
);
193195
let test_entity_3_1 = create_test_entity(
194196
"3",
@@ -199,6 +201,7 @@ async fn insert_test_data(store: Arc<DieselSubgraphStore>) -> DeploymentLocator
199201
111.7,
200202
false,
201203
Some("blue"),
204+
2,
202205
);
203206
transact_entity_operations(
204207
&store,
@@ -218,6 +221,7 @@ async fn insert_test_data(store: Arc<DieselSubgraphStore>) -> DeploymentLocator
218221
111.7,
219222
false,
220223
None,
224+
3,
221225
);
222226
transact_entity_operations(
223227
&store,
@@ -241,6 +245,7 @@ fn create_test_entity(
241245
weight: f64,
242246
coffee: bool,
243247
favorite_color: Option<&str>,
248+
vid: i64,
244249
) -> EntityOperation {
245250
let bin_name = scalar::Bytes::from_str(&hex::encode(name)).unwrap();
246251
let test_entity = entity! { TEST_SUBGRAPH_SCHEMA =>
@@ -252,7 +257,8 @@ fn create_test_entity(
252257
seconds_age: age * 31557600,
253258
weight: Value::BigDecimal(weight.into()),
254259
coffee: coffee,
255-
favorite_color: favorite_color
260+
favorite_color: favorite_color,
261+
vid: vid,
256262
};
257263

258264
let entity_type = TEST_SUBGRAPH_SCHEMA.entity_type(entity_type).unwrap();
@@ -601,6 +607,7 @@ fn prune() {
601607
157.1,
602608
true,
603609
Some("red"),
610+
4,
604611
);
605612
transact_and_wait(&store, &src, BLOCKS[5].clone(), vec![user2])
606613
.await

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ fn insert_user_entity(
318318
drinks: Option<Vec<&str>>,
319319
visits: i64,
320320
block: BlockNumber,
321+
vid: i64,
321322
) {
322323
let user = make_user(
323324
&layout.input_schema,
@@ -330,6 +331,7 @@ fn insert_user_entity(
330331
favorite_color,
331332
drinks,
332333
visits,
334+
vid,
333335
);
334336

335337
insert_entity_at(conn, layout, entity_type, vec![user], block);
@@ -346,6 +348,7 @@ fn make_user(
346348
favorite_color: Option<&str>,
347349
drinks: Option<Vec<&str>>,
348350
visits: i64,
351+
vid: i64,
349352
) -> Entity {
350353
let favorite_color = favorite_color
351354
.map(|s| Value::String(s.to_owned()))
@@ -361,7 +364,8 @@ fn make_user(
361364
weight: BigDecimal::from(weight),
362365
coffee: coffee,
363366
favorite_color: favorite_color,
364-
visits: visits
367+
visits: visits,
368+
vid: vid,
365369
};
366370
if let Some(drinks) = drinks {
367371
user.insert("drinks", drinks.into()).unwrap();
@@ -384,6 +388,7 @@ fn insert_users(conn: &mut PgConnection, layout: &Layout) {
384388
None,
385389
60,
386390
0,
391+
0,
387392
);
388393
insert_user_entity(
389394
conn,
@@ -399,6 +404,7 @@ fn insert_users(conn: &mut PgConnection, layout: &Layout) {
399404
Some(vec!["beer", "wine"]),
400405
50,
401406
0,
407+
1,
402408
);
403409
insert_user_entity(
404410
conn,
@@ -414,6 +420,7 @@ fn insert_users(conn: &mut PgConnection, layout: &Layout) {
414420
Some(vec!["coffee", "tea"]),
415421
22,
416422
0,
423+
2,
417424
);
418425
}
419426

@@ -431,6 +438,7 @@ fn update_user_entity(
431438
drinks: Option<Vec<&str>>,
432439
visits: i64,
433440
block: BlockNumber,
441+
vid: i64,
434442
) {
435443
let user = make_user(
436444
&layout.input_schema,
@@ -443,6 +451,7 @@ fn update_user_entity(
443451
favorite_color,
444452
drinks,
445453
visits,
454+
vid,
446455
);
447456
update_entity_at(conn, layout, entity_type, vec![user], block);
448457
}
@@ -1050,6 +1059,7 @@ impl<'a> QueryChecker<'a> {
10501059
None,
10511060
23,
10521061
0,
1062+
3,
10531063
);
10541064
insert_pets(conn, layout);
10551065

@@ -1162,6 +1172,7 @@ fn check_block_finds() {
11621172
None,
11631173
55,
11641174
1,
1175+
4,
11651176
);
11661177

11671178
checker

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ pub fn row_group_insert(
9797
) -> RowGroup {
9898
let mut group = RowGroup::new(entity_type.clone(), false);
9999
for (key, data) in data {
100+
let vid = data.vid();
100101
group
101-
.push(EntityModification::insert(key, data, block, 0), block)
102+
.push(EntityModification::insert(key, data, block, vid), block)
102103
.unwrap();
103104
}
104105
group

0 commit comments

Comments
 (0)