From 50476a7cc77b375e3aa793ed93155715dfd1241e Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov Date: Mon, 13 Mar 2023 14:30:43 +0200 Subject: [PATCH] test: update to match current interfaces --- pageserver/src/tenant.rs | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index aa77196f2c..6a373ad520 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -3178,30 +3178,39 @@ mod tests { #[tokio::test] async fn test_get_branchpoints_from_an_inactive_timeline() -> anyhow::Result<()> { - let tenant = - TenantHarness::create("test_get_branchpoints_from_an_inactive_timeline")?.load(); + let (tenant, ctx) = + TenantHarness::create("test_get_branchpoints_from_an_inactive_timeline")? + .load() + .await; let tline = tenant - .create_empty_timeline(TIMELINE_ID, Lsn(0), DEFAULT_PG_VERSION)? - .initialize()?; - tline.set_state(TimelineState::Paused); + .create_empty_timeline(TIMELINE_ID, Lsn(0), DEFAULT_PG_VERSION, &ctx)? + .initialize(&ctx)?; make_some_layers(tline.as_ref(), Lsn(0x20)).await?; - tenant.branch_timeline(TIMELINE_ID, NEW_TIMELINE_ID, Some(Lsn(0x40)))?; + tenant + .branch_timeline(&tline, NEW_TIMELINE_ID, Some(Lsn(0x40)), &ctx) + .await?; let newtline = tenant .get_timeline(NEW_TIMELINE_ID, true) .expect("Should have a local timeline"); make_some_layers(newtline.as_ref(), Lsn(0x60)).await?; - tenant.gc_iteration(Some(TIMELINE_ID), 0x10, Duration::ZERO, false).await?; - + + tline.set_state(TimelineState::Broken); + + tenant + .gc_iteration(Some(TIMELINE_ID), 0x10, Duration::ZERO, &ctx) + .await?; + assert_eq!( - newtline.get(*TEST_KEY, Lsn(0x50))?, - TEST_IMG(&format!("foo at {}", Lsn(0x40)))); + newtline.get(*TEST_KEY, Lsn(0x50), &ctx).await?, + TEST_IMG(&format!("foo at {}", Lsn(0x40))) + ); let branchpoints = &tline.gc_info.read().unwrap().retain_lsns; assert_eq!(branchpoints.len(), 1); assert_eq!(branchpoints[0], Lsn(0x40)); - + Ok(()) }