Skip to content

Commit 32b6b92

Browse files
committed
sentry - routes - analytics - fix test:
1st day of the month test fix for Timeframe::Year
1 parent 33f25dc commit 32b6b92

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sentry/src/routes/analytics.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ mod test {
118118

119119
use super::*;
120120
use adapter::ethereum::test_util::{GANACHE_1, GANACHE_1337};
121-
use chrono::Utc;
121+
use chrono::{Datelike, Utc};
122122
use primitives::{
123123
analytics::{
124124
query::{AllowedKey, Time},
@@ -827,8 +827,16 @@ mod test {
827827

828828
let fetched_analytics = analytics_response.0.analytics;
829829

830+
// because data is grouped by month, when it's the 1st day of the month
831+
// and the CI runs, this causes a failing test.
832+
let expected = if Utc::today().day() == 1 {
833+
vec![FetchedMetric::Count(58), FetchedMetric::Count(42)]
834+
} else {
835+
vec![FetchedMetric::Count(100)]
836+
};
837+
830838
assert_eq!(
831-
vec![FetchedMetric::Count(100)],
839+
expected,
832840
fetched_analytics
833841
.iter()
834842
.map(|fetched| fetched.value)

0 commit comments

Comments
 (0)