Skip to content

Commit 397acdc

Browse files
authored
test(observability-metrics-aws-cloudwatch): fix time-rotted default-step test (#279)
* test(observability-metrics-aws-cloudwatch): fix time-rotted default-step test TestGetResourceMetricsAppliesDefaultStep hardcoded a fixed start time (2026-05-04) that flows into normalizeStandardMetricPeriod, which derives the minimum period from time.Since(start) against the real wall clock. Once the wall clock passed the 63-day retention threshold, the minimum period was bumped from 300s to 3600s, breaking the "default step" assertion. Use a time.Now()-relative start time so the query window stays recent, matching the sibling tests (NormalizesSubMinuteStep, etc.) and keeping the test focused on the behavior it asserts. Signed-off-by: Akila-I <akila.99g@gmail.com> * chore: bump version to 0.1.1 for GCP Cloud Logging module Signed-off-by: Akila-I <akila.99g@gmail.com> --------- Signed-off-by: Akila-I <akila.99g@gmail.com>
1 parent aee086e commit 397acdc

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

  • observability-logs-gcp-cloudlogging
  • observability-metrics-aws-cloudwatch/internal/cloudwatchmetrics
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.1.1

observability-metrics-aws-cloudwatch/internal/cloudwatchmetrics/queries_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func TestGetResourceMetricsHappyPath(t *testing.T) {
112112
}
113113

114114
func TestGetResourceMetricsAppliesDefaultStep(t *testing.T) {
115-
now := time.Date(2026, 5, 4, 12, 0, 0, 0, time.UTC)
115+
now := time.Now().UTC()
116116
var captured *cloudwatch.GetMetricDataInput
117117
api := &stubCloudWatchAPI{
118118
getMetricDataFunc: func(in *cloudwatch.GetMetricDataInput) (*cloudwatch.GetMetricDataOutput, error) {

0 commit comments

Comments
 (0)