mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-23 06:09:59 +00:00
previous commit broke the tests because of the cfg business, see this commit's TODO
This commit is contained in:
@@ -9605,7 +9605,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Test leasing same standby_horizon by different ID yields a fresh lease.
|
// Test leasing same LSN by different ID yields a fresh lease.
|
||||||
// NB: leases are tracked by SystemTime, which is not monotonic, but we want to assert monotonicity of the lease below.
|
// NB: leases are tracked by SystemTime, which is not monotonic, but we want to assert monotonicity of the lease below.
|
||||||
// Sleep a second to make flakiness less likely.
|
// Sleep a second to make flakiness less likely.
|
||||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||||
@@ -9652,12 +9652,18 @@ mod tests {
|
|||||||
// Verify standby horizons did hold up GC
|
// Verify standby horizons did hold up GC
|
||||||
//
|
//
|
||||||
|
|
||||||
// 0x20 was the lowest horizon
|
// 0x20 was the lowest horizon but
|
||||||
assert_eq!(*timeline.get_applied_gc_cutoff_lsn(), Lsn(0x20));
|
// TODO cfg(test) forces the new feature right now for coverage.
|
||||||
|
let expected_cutoff = if cfg!(test) || cfg!(feature = "testing") {
|
||||||
|
leases.iter().map(|(lsn, _)| *lsn).min().unwrap()
|
||||||
|
} else {
|
||||||
|
legacy
|
||||||
|
};
|
||||||
|
assert_eq!(*timeline.get_applied_gc_cutoff_lsn(), expected_cutoff);
|
||||||
|
|
||||||
// Legacy propagation mechanism gets cleared by gc
|
// Legacy propagation mechanism gets cleared by gc
|
||||||
assert_eq!(timeline.standby_horizons.legacy(), None);
|
assert_eq!(timeline.standby_horizons.legacy(), None);
|
||||||
// Leases do not hold up GC
|
// Leases are unaffected.
|
||||||
assert_eq!(timeline.standby_horizons.get_leases().len(), 4);
|
assert_eq!(timeline.standby_horizons.get_leases().len(), 4);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -6593,7 +6593,7 @@ impl Timeline {
|
|||||||
);
|
);
|
||||||
let min_standby_horizon = if cfg!(test) || cfg!(feature = "testing") {
|
let min_standby_horizon = if cfg!(test) || cfg!(feature = "testing") {
|
||||||
// TODO: parametrize rust test / test suite over the feature flag?
|
// TODO: parametrize rust test / test suite over the feature flag?
|
||||||
// For now, test the new feature.
|
// For now, test the new feature. Fix this.
|
||||||
min_standby_horizon.leases
|
min_standby_horizon.leases
|
||||||
} else {
|
} else {
|
||||||
match flag_evaluation_result.as_deref() {
|
match flag_evaluation_result.as_deref() {
|
||||||
|
|||||||
Reference in New Issue
Block a user