MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / update_operation_stats_test

Function update_operation_stats_test

src/rocksdb/tests/basic.rs:264–309  ·  view source on GitHub ↗

unsupported operation: can't call foreign function `rocksdb_create_default_env` on OS `linux`

()

Source from the content-addressed store, hash-verified

262#[mz_ore::test(tokio::test)]
263#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `rocksdb_create_default_env` on OS `linux`
264async fn update_operation_stats_test() -> Result<(), anyhow::Error> {
265 // If the test aborts, this may not be cleaned up.
266 let t = tempfile::tempdir()?;
267
268 let mut instance = RocksDBInstance::<String, String>::new(
269 t.path().join("5").as_path(),
270 InstanceOptions::<bincode::DefaultOptions, String, StubMergeOperator<String>>::new(
271 rocksdb::Env::new()?,
272 2,
273 None,
274 bincode::DefaultOptions::new(),
275 ),
276 RocksDBConfig::new(Default::default(), None),
277 shared_metrics_for_tests()?,
278 instance_metrics_for_tests()?,
279 )?;
280
281 let stats = instance
282 .multi_update(vec![
283 (
284 "two".to_string(),
285 KeyUpdate::Put("twov1".to_string()),
286 Some(Diff::ONE),
287 ),
288 (
289 "two".to_string(),
290 KeyUpdate::Put("twov1".to_string()),
291 Some(Diff::MINUS_ONE),
292 ),
293 (
294 "two".to_string(),
295 KeyUpdate::Put("twov2".to_string()),
296 Some(Diff::ONE),
297 ),
298 ])
299 .await?;
300 assert_eq!(stats.processed_updates, 3);
301 assert_eq!(
302 Diff::try_from(stats.size_written).unwrap(),
303 Diff::from(3) * stats.size_diff.unwrap()
304 );
305
306 instance.close().await?;
307
308 Ok(())
309}
310
311#[mz_ore::test(tokio::test)]
312#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `rocksdb_create_default_env` on OS `linux`

Callers

nothing calls this directly

Calls 6

shared_metrics_for_testsFunction · 0.85
multi_updateMethod · 0.80
joinMethod · 0.45
pathMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected