Skip to content

Commit

Permalink
source-postgres-batch: Run tests in consistent TZ
Browse files Browse the repository at this point in the history
As discussed in the comment, this is a workaround for a cause of
test snapshot instability. The fact that the workaround is needed
is itself indicative of a bug, but for now I just want tests to
demonstrate current behavior.
  • Loading branch information
willdonnelly committed Feb 14, 2025
1 parent e931ede commit a6838ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source-postgres-batch/.snapshots/TestDateAndTimeTypes-Capture
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ================================
# Collection "acmeCo/test/test_dateandtimetypes_307398": 10 Documents
# ================================
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2025-02-14T00:00:00Z","id":0,"interval_col":"1 year 2 mons 3 days 04:05:06","time_col":"14:44:29","timetz_col":"14:44:29-05","ts_col":"2025-02-14T14:44:29Z","tstz_col":"2025-02-13T23:44:29-06:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"1969-07-20T00:00:00Z","id":1,"interval_col":"50 years","time_col":"20:17:00","timetz_col":"20:17:00-04","ts_col":"1969-07-20T20:17:00Z","tstz_col":"1969-07-20T15:17:00-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2077-07-20T00:00:00Z","id":2,"interval_col":"100 years","time_col":"15:30:00","timetz_col":"15:30:00+09","ts_col":"2077-07-20T15:30:00Z","tstz_col":"2077-07-20T01:30:00-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"0001-01-01T00:00:00Z","id":3,"interval_col":"00:00:00.000001","time_col":"00:00:00","timetz_col":"00:00:00+00","ts_col":"0001-01-01T00:00:00Z","tstz_col":"0000-12-31T18:09:24-05:50","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"9999-12-31T00:00:00Z","id":4,"interval_col":"1000 years","time_col":"23:59:59.999999","timetz_col":"23:59:59.999999+00","ts_col":"9999-12-31T23:59:59.999999Z","tstz_col":"9999-12-31T17:59:59.999999-06:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":5,"interval_col":"-178000000 years","time_col":"15:30:45","timetz_col":"15:30:45+00","ts_col":"2024-02-14T15:30:45Z","tstz_col":"2024-02-14T09:30:45-06:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":6,"interval_col":"178000000 years","time_col":"15:30:45","timetz_col":"15:30:45+00","ts_col":"2024-02-14T15:30:45Z","tstz_col":"2024-02-14T09:30:45-06:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":7,"interval_col":"00:00:01.123456","time_col":"15:30:45.123456","timetz_col":"15:30:45.123456+00","ts_col":"2024-02-14T15:30:45.123456Z","tstz_col":"2024-02-14T09:30:45.123456-06:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":8,"interval_col":"2 years 3 mons 4 days 12:30:45.123456","time_col":"15:30:45","timetz_col":"15:30:45+00","ts_col":"2024-02-14T15:30:45Z","tstz_col":"2024-02-14T09:30:45-06:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2025-02-14T00:00:00Z","id":0,"interval_col":"1 year 2 mons 3 days 04:05:06","time_col":"14:44:29","timetz_col":"14:44:29-05","ts_col":"2025-02-14T14:44:29Z","tstz_col":"2025-02-14T00:44:29-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"1969-07-20T00:00:00Z","id":1,"interval_col":"50 years","time_col":"20:17:00","timetz_col":"20:17:00-04","ts_col":"1969-07-20T20:17:00Z","tstz_col":"1969-07-20T16:17:00-04:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2077-07-20T00:00:00Z","id":2,"interval_col":"100 years","time_col":"15:30:00","timetz_col":"15:30:00+09","ts_col":"2077-07-20T15:30:00Z","tstz_col":"2077-07-20T02:30:00-04:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"0001-01-01T00:00:00Z","id":3,"interval_col":"00:00:00.000001","time_col":"00:00:00","timetz_col":"00:00:00+00","ts_col":"0001-01-01T00:00:00Z","tstz_col":"0000-12-31T19:03:58-04:56","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"9999-12-31T00:00:00Z","id":4,"interval_col":"1000 years","time_col":"23:59:59.999999","timetz_col":"23:59:59.999999+00","ts_col":"9999-12-31T23:59:59.999999Z","tstz_col":"9999-12-31T18:59:59.999999-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":5,"interval_col":"-178000000 years","time_col":"15:30:45","timetz_col":"15:30:45+00","ts_col":"2024-02-14T15:30:45Z","tstz_col":"2024-02-14T10:30:45-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":6,"interval_col":"178000000 years","time_col":"15:30:45","timetz_col":"15:30:45+00","ts_col":"2024-02-14T15:30:45Z","tstz_col":"2024-02-14T10:30:45-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":7,"interval_col":"00:00:01.123456","time_col":"15:30:45.123456","timetz_col":"15:30:45.123456+00","ts_col":"2024-02-14T15:30:45.123456Z","tstz_col":"2024-02-14T10:30:45.123456-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":"2024-02-14T00:00:00Z","id":8,"interval_col":"2 years 3 mons 4 days 12:30:45.123456","time_col":"15:30:45","timetz_col":"15:30:45+00","ts_col":"2024-02-14T15:30:45Z","tstz_col":"2024-02-14T10:30:45-05:00","txid":999999}
{"_meta":{"polled":"<TIMESTAMP>","index":999},"date_col":null,"id":9,"interval_col":null,"time_col":null,"timetz_col":null,"ts_col":null,"tstz_col":null,"txid":999999}
# ================================
# Final State Checkpoint
Expand Down
5 changes: 5 additions & 0 deletions source-postgres-batch/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func TestMain(m *testing.M) {
} else {
log.SetLevel(log.InfoLevel)
}
// Some tested behaviors (TestDateAndTimeTypes) are timezone-sensitive. This
// is arguably a bug, but the goal of the current work is just to document
// via test snapshots the current behavior. So we set the timezone to a known
// value to avoid test failures due to timezone differences, especially in CI.
os.Setenv("TZ", "America/New_York")
os.Exit(m.Run())
}

Expand Down

0 comments on commit a6838ed

Please sign in to comment.