From 0cb35f5282d4dc0a3710352df8fcb5dc2c993afd Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Mon, 13 May 2024 16:10:18 +0200 Subject: [PATCH] shortify old test --- crates/re_query/tests/range.rs | 44 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/crates/re_query/tests/range.rs b/crates/re_query/tests/range.rs index 15c2b65f31a89..84c9f3a3b3176 100644 --- a/crates/re_query/tests/range.rs +++ b/crates/re_query/tests/range.rs @@ -872,34 +872,26 @@ fn concurrent_multitenant_edge_case() -> anyhow::Result<()> { let entity_path: EntityPath = "point".into(); - let timepoint1 = [build_frame_nr(123)]; - let points1 = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row1 = DataRow::from_cells1_sized( - RowId::new(), - entity_path.clone(), - timepoint1, - points1.clone(), - )?; - insert_and_react(&mut store, &mut caches, &row1); + let add_points = |time: i64, point_value: f32| { + let timepoint = [build_frame_nr(time)]; + let points = vec![ + MyPoint::new(point_value, point_value + 1.0), + MyPoint::new(point_value + 2.0, point_value + 3.0), + ]; + let row = DataRow::from_cells1_sized( + RowId::new(), + entity_path.clone(), + timepoint, + points.clone(), + )?; + Ok::<_, DataReadError>((timepoint, points, row)) + }; - let timepoint2 = [build_frame_nr(223)]; - let points2 = vec![MyPoint::new(10.0, 20.0), MyPoint::new(30.0, 40.0)]; - let row2 = DataRow::from_cells1_sized( - RowId::new(), - entity_path.clone(), - timepoint2, - points2.clone(), - )?; + let (timepoint1, points1, row1) = add_points(123, 1.0)?; + insert_and_react(&mut store, &mut caches, &row1); + let (_timepoint2, points2, row2) = add_points(223, 2.0)?; insert_and_react(&mut store, &mut caches, &row2); - - let timepoint3 = [build_frame_nr(323)]; - let points3 = vec![MyPoint::new(100.0, 200.0), MyPoint::new(300.0, 400.0)]; - let row3 = DataRow::from_cells1_sized( - RowId::new(), - entity_path.clone(), - timepoint3, - points3.clone(), - )?; + let (_timepoint3, points3, row3) = add_points(323, 3.0)?; insert_and_react(&mut store, &mut caches, &row3); // --- Tenant #1 queries the data, but doesn't cache the result in the deserialization cache ---