test: require fresh raw data in production smoke
This commit is contained in:
@@ -136,6 +136,39 @@ class GoNativeProdSmokeTest(unittest.TestCase):
|
||||
self.assertEqual(check.status, "fail")
|
||||
self.assertIn("online=false", check.message)
|
||||
|
||||
def test_parse_tdengine_utc_timestamp_as_aware_utc(self):
|
||||
parsed = smoke.parse_tdengine_utc_timestamp("2026-07-01 17:36:02")
|
||||
|
||||
self.assertEqual(parsed, dt.datetime(2026, 7, 1, 17, 36, 2, tzinfo=dt.timezone.utc))
|
||||
|
||||
def test_total_check_fails_when_latest_sample_is_stale(self):
|
||||
now = dt.datetime(2026, 7, 1, 18, 0, 0, tzinfo=dt.timezone.utc)
|
||||
|
||||
check = smoke.check_total(
|
||||
"gb32960.raw",
|
||||
{"total": 1, "items": [{"ts": "2026-07-01 17:00:00"}]},
|
||||
minimum=1,
|
||||
max_age_minutes=30,
|
||||
now=now,
|
||||
)
|
||||
|
||||
self.assertEqual(check.status, "fail")
|
||||
self.assertIn("latest_age_minutes=60.0", check.message)
|
||||
|
||||
def test_total_check_passes_when_latest_sample_is_fresh(self):
|
||||
now = dt.datetime(2026, 7, 1, 18, 0, 0, tzinfo=dt.timezone.utc)
|
||||
|
||||
check = smoke.check_total(
|
||||
"gb32960.raw",
|
||||
{"total": 1, "items": [{"ts": "2026-07-01 17:45:00"}]},
|
||||
minimum=1,
|
||||
max_age_minutes=30,
|
||||
now=now,
|
||||
)
|
||||
|
||||
self.assertEqual(check.status, "pass")
|
||||
self.assertIn("latest_age_minutes=15.0", check.message)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user