Skip to content

Commit

Permalink
fix: a test is failing on master due to current-time dependencies (#6706
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
colin-sentry authored Dec 30, 2024
1 parent 5c55d02 commit 0680d3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rust_snuba/src/mutations/clickhouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ struct MutationRow {
#[cfg(test)]
mod tests {
use std::env;
use std::time::{SystemTime, UNIX_EPOCH};
use uuid::Uuid;

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

let organization_id = 69;
let _sort_timestamp = 1727466947;
let curr_time_unix = SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("Time went backwards")
.as_secs();
let _sort_timestamp = curr_time_unix as u32; //TODO year 2038 problem
let trace_id = Uuid::parse_str("deadbeef-dead-beef-dead-beefdeadbeef").unwrap();
let span_id = 16045690984833335023;

Expand Down

0 comments on commit 0680d3b

Please sign in to comment.