test(observability-metrics-aws-cloudwatch): fix time-rotted default-step test#279
Conversation
…tep 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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes bump the Cloud Logging package version from 0.1.0 to 0.1.1 and update a CloudWatch test to use the current UTC time instead of a fixed timestamp. ChangesPackage release metadata
CloudWatch test timestamp
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Akila-I <akila.99g@gmail.com>
Purpose
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.
Approach
Related Issues
Checklist
Remarks
Summary by CodeRabbit
Chores
Tests