Skip to content

Commit 0680d3b

Browse files
authored
fix: a test is failing on master due to current-time dependencies (#6706)
This test does something like this: ``` CREATE TABLE temp AS eap_spans_2_local; INSERT INTO temp (some data) -- irrelevant SELECT * FROM temp ``` The problem is that eap_spans_2_local has a TTL of 90 days, so between steps 2 and 3, the data is deleted (the hardcoded timestamp is now more than 90 days old!) This updates the timestamp used by the test to be recent, so that the data isn't TTL-d out before the test can use it.
1 parent 5c55d02 commit 0680d3b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rust_snuba/src/mutations/clickhouse.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ struct MutationRow {
211211
#[cfg(test)]
212212
mod tests {
213213
use std::env;
214+
use std::time::{SystemTime, UNIX_EPOCH};
214215
use uuid::Uuid;
215216

216217
use crate::mutations::parser::Update;
@@ -284,7 +285,11 @@ mod tests {
284285
let mut update = Update::default();
285286

286287
let organization_id = 69;
287-
let _sort_timestamp = 1727466947;
288+
let curr_time_unix = SystemTime::now()
289+
.duration_since(UNIX_EPOCH)
290+
.expect("Time went backwards")
291+
.as_secs();
292+
let _sort_timestamp = curr_time_unix as u32; //TODO year 2038 problem
288293
let trace_id = Uuid::parse_str("deadbeef-dead-beef-dead-beefdeadbeef").unwrap();
289294
let span_id = 16045690984833335023;
290295

0 commit comments

Comments
 (0)