armada
armada copied to clipboard
Unit-test failures on systems where timezone is not UTC
Running the Armada unit-tests (by doing mage tests
) results in 3 consistent test failures, when the host system's timezone is not set to UTC. These are where timestamp values from Postgres are returned in the local timezone offset, and not the "Zulu"/UTC time as expected in the tests. For example, on my system, where the zone is set to America/Denver
(aka 'MST7MDT'), the results are below.
Either the test logic should be adjusted to reflect the timezone in effect on the system the tests are running on, or we should document in the developer docs to use the work-around of running the tests by doing env TZ=UTC mage tests
, which causes all tests to succeed.
=== FAIL: internal/lookoutv2/repository TestGroupByAnnotationWithFiltersAndAggregates (1.10s)
groupjobs_test.go:1148:
Error Trace: /home/rich/work/armada/internal/lookoutv2/repository/groupjobs_test.go:1148
/home/rich/work/armada/internal/common/database/db_testutil.go:62
/home/rich/work/armada/internal/common/database/lookout/util.go:15
/home/rich/work/armada/internal/lookoutv2/repository/groupjobs_test.go:1041
Error: Not equal:
expected: []*model.JobGroup{(*model.JobGroup)(0xc000dcdbc0), (*model.JobGroup)(0xc000dcdd40), (*model.JobGroup)(0xc000dcde40), (*model.JobGroup)(0xc000dcdf60)}
actual : []*model.JobGroup{(*model.JobGroup)(0xc000dcdfc0), (*model.JobGroup)(0xc000dcdfe0), (*model.JobGroup)(0xc001282000), (*model.JobGroup)(0xc001282020)}
Diff:
--- Expected
+++ Actual
@@ -3,3 +3,3 @@
Aggregates: (map[string]interface {}) (len=2) {
- (string) (len=18) "lastTransitionTime": (string) (len=25) "2022-03-01T08:54:05-07:00",
+ (string) (len=18) "lastTransitionTime": (string) (len=20) "2022-03-01T15:54:05Z",
(string) (len=9) "submitted": (string) (len=20) "2022-03-01T15:24:05Z"
@@ -11,3 +11,3 @@
Aggregates: (map[string]interface {}) (len=2) {
- (string) (len=18) "lastTransitionTime": (string) (len=25) "2022-03-01T08:14:05-07:00",
+ (string) (len=18) "lastTransitionTime": (string) (len=20) "2022-03-01T15:14:05Z",
(string) (len=9) "submitted": (string) (len=20) "2022-03-01T15:05:05Z"
@@ -19,3 +19,3 @@
Aggregates: (map[string]interface {}) (len=2) {
- (string) (len=18) "lastTransitionTime": (string) (len=25) "2022-03-01T08:09:05-07:00",
+ (string) (len=18) "lastTransitionTime": (string) (len=20) "2022-03-01T15:09:05Z",
(string) (len=9) "submitted": (string) (len=20) "2022-03-01T15:07:05Z"
@@ -27,3 +27,3 @@
Aggregates: (map[string]interface {}) (len=2) {
- (string) (len=18) "lastTransitionTime": (string) (len=25) "2022-03-01T08:04:05-07:00",
+ (string) (len=18) "lastTransitionTime": (string) (len=20) "2022-03-01T15:04:05Z",
(string) (len=9) "submitted": (string) (len=20) "2022-03-01T15:04:05Z"
Test: TestGroupByAnnotationWithFiltersAndAggregates