Skip to content

Commit

Permalink
test: fix duplicated harness name (#8010)
Browse files Browse the repository at this point in the history
We need unique tenant harness names in case you want to inspect the
results of the last failing run. We are not using any proc macros to get
the test name as there is no stable way of doing that, and there will
not be one in the future, so we need to fix these duplicates.

Also, clean up the duplicated tests to not mix `?` and `unwrap/assert`.
  • Loading branch information
koivunej committed Jun 11, 2024
1 parent 7515d0f commit d3b892e
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions pageserver/src/tenant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6584,8 +6584,8 @@ mod tests {
}

#[tokio::test]
async fn test_metadata_tombstone_image_creation() -> anyhow::Result<()> {
let harness = TenantHarness::create("test_metadata_tombstone_image_creation")?;
async fn test_metadata_tombstone_image_creation() {
let harness = TenantHarness::create("test_metadata_tombstone_image_creation").unwrap();
let (tenant, ctx) = harness.load().await;

let key0 = Key::from_hex("620000000033333333444444445500000000").unwrap();
Expand Down Expand Up @@ -6613,7 +6613,8 @@ mod tests {
vec![(Lsn(0x10), vec![(key1, test_img("metadata key 1"))])],
Lsn(0x30),
)
.await?;
.await
.unwrap();

let cancel = CancellationToken::new();

Expand All @@ -6628,23 +6629,24 @@ mod tests {
},
&ctx,
)
.await?;
.await
.unwrap();

// Image layers are created at last_record_lsn
let images = tline
.inspect_image_layers(Lsn(0x30), &ctx)
.await?
.await
.unwrap()
.into_iter()
.filter(|(k, _)| k.is_metadata_key())
.collect::<Vec<_>>();
assert_eq!(images.len(), 2); // the image layer should only contain two existing keys, tombstones should be removed.

Ok(())
}

#[tokio::test]
async fn test_metadata_tombstone_empty_image_creation() -> anyhow::Result<()> {
let harness = TenantHarness::create("test_metadata_tombstone_image_creation")?;
async fn test_metadata_tombstone_empty_image_creation() {
let harness =
TenantHarness::create("test_metadata_tombstone_empty_image_creation").unwrap();
let (tenant, ctx) = harness.load().await;

let key1 = Key::from_hex("620000000033333333444444445500000001").unwrap();
Expand All @@ -6666,7 +6668,8 @@ mod tests {
vec![(Lsn(0x10), vec![(key1, test_img("metadata key 1"))])],
Lsn(0x30),
)
.await?;
.await
.unwrap();

let cancel = CancellationToken::new();

Expand All @@ -6681,17 +6684,17 @@ mod tests {
},
&ctx,
)
.await?;
.await
.unwrap();

// Image layers are created at last_record_lsn
let images = tline
.inspect_image_layers(Lsn(0x30), &ctx)
.await?
.await
.unwrap()
.into_iter()
.filter(|(k, _)| k.is_metadata_key())
.collect::<Vec<_>>();
assert_eq!(images.len(), 0); // the image layer should not contain tombstones, or it is not created

Ok(())
}
}

1 comment on commit d3b892e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3286 tests run: 3131 passed, 0 failed, 155 skipped (full report)


Flaky tests (1)

Postgres 14

  • test_sharding_split_compaction[compact-shard-ancestors-persistent]: release

Code coverage* (full report)

  • functions: 31.5% (6606 of 20948 functions)
  • lines: 48.5% (51097 of 105417 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
d3b892e at 2024-06-11T15:34:07.403Z :recycle:

Please sign in to comment.