populationgenomics / metamist

Sample level metadata system
MIT License
1 stars 1 forks source link

Check time-dependent tests on CI worker #737

Closed jmarshall closed 4 months ago

jmarshall commented 4 months ago

Running these tests locally in a timezone well ahead of UTC gives:

test/test_sequencing_groups.py::TestSequencingGroup::test_query_with_creation_date 
date.today()=datetime.date(2024, 4, 23)
Tue 23 Apr 2024 11:27:01 NZST
FAILED
test/test_sequencing_groups.py::TestSequencingGroup::test_query_with_creation_date_UTC sample_to_insert=SampleUpsertInternal(id=None, external_id='EX_ID', meta={}, project=None, type=None, participant_id=None, active=None, sequencing_groups=[SequencingGroupUpsertInternal(id=None, type='genome', technology='short-read', platform='ILLUMINA', meta={'meta-key': 'meta-value'}, sample_id=None, external_ids={}, assays=[AssayUpsertInternal(id=None, type='sequencing', external_ids={}, sample_id=None, meta={'sequencing_type': 'genome', 'sequencing_platform': 'short-read', 'sequencing_technology': 'illumina'})])], non_sequencing_assays=None)

bad: today_bad=datetime.date(2024, 4, 23) type(today_bad)=<class 'datetime.date'>
good: today=datetime.date(2024, 4, 22) type(today)=<class 'datetime.date'>
sgs=[]
PASSED

Context: https://centrepopgen.slack.com/archives/C03FZL2EF24/p1713493526442429

… … …

And the output from CI is:

date.today()=datetime.date(2024, 4, 22)
date command: Mon Apr 22 23:43:14 UTC 2024

sample_to_insert=SampleUpsertInternal(id=None, external_id='EX_ID', meta={}, project=None, type=None, participant_id=None, active=None, sequencing_groups=[SequencingGroupUpsertInternal(id=None, type='genome', technology='short-read', platform='ILLUMINA', meta={'meta-key': 'meta-value'}, sample_id=None, external_ids={}, assays=[AssayUpsertInternal(id=None, type='sequencing', external_ids={}, sample_id=None, meta={'sequencing_type': 'genome', 'sequencing_platform': 'short-read', 'sequencing_technology': 'illumina'})])], non_sequencing_assays=None)
bad: today_bad=datetime.date(2024, 4, 22) type(today_bad)=<class 'datetime.date'>
good: today=datetime.date(2024, 4, 22) type(today)=<class 'datetime.date'>
sgs=[]

This largely confirms the theory that tests never failed like this in CI because the workers run in UTC, so there is never this yesterday confusion.