From 1417c6880e481a30e76e15cfcb0f6c4c13d631d1 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 30 Mar 2023 16:00:10 +0200 Subject: [PATCH] fix: cfg(not(feature = testing)) builds --- pageserver/src/disk_usage_eviction_task.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pageserver/src/disk_usage_eviction_task.rs b/pageserver/src/disk_usage_eviction_task.rs index 0c4a4361e6..e282b44bb4 100644 --- a/pageserver/src/disk_usage_eviction_task.rs +++ b/pageserver/src/disk_usage_eviction_task.rs @@ -654,7 +654,18 @@ mod filesystem_level_usage { tenants_dir: &Path, config: &'a DiskUsageEvictionTaskConfig, ) -> anyhow::Result> { - let stat = Statvfs::get(tenants_dir, config.mock_statvfs.as_ref()) + let mock_config = { + #[cfg(feature = "testing")] + { + config.mock_statvfs.as_ref() + } + #[cfg(not(feature = "testing"))] + { + None + } + }; + + let stat = Statvfs::get(tenants_dir, mock_config) .context("statvfs failed, presumably directory got unlinked")?; // https://unix.stackexchange.com/a/703650