Skip to content

Fix intermittent failure in React UI Time test  #43146

@omkar-foss

Description

@omkar-foss

Apache Airflow version

main (development)

If "Other Airflow 2 version" selected, which one?

None

What happened?

Test fails intermittently when there's a second's difference between the variables getting initialized. GitHub run for reference: https://github.com/apache/airflow/actions/runs/11399466779/job/31718337427?pr=43084#step:9:48

Test failure:

❯ src/components/Time.test.tsx  (2 tests | 1 failed) 169ms
   × Test Time and TimezoneProvider > Displays a set timezone, includes UTC date in title
     → expected '2024-10-18, 07:34:18 UTC' to deeply equal '2024-10-18, 07:34:19 UTC'
 ✓ src/utils/RouterWrapper.test.tsx  (2 tests) 19ms
 ✓ src/utils/ChakraWrapper.test.tsx  (2 tests) 84ms

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/components/Time.test.tsx > Test Time and TimezoneProvider > Displays a set timezone, includes UTC date in title
AssertionError: expected '2024-10-18, 07:34:18 UTC' to deeply equal '2024-10-18, 07:34:19 UTC'

Expected: "2024-10-18, 07:34:19 UTC"
Received: "2024-10-18, 07:34:18 UTC"

 ❯ src/components/Time.test.tsx:60:29
     [58](https://github.com/apache/airflow/actions/runs/11399466779/job/31718337427?pr=43084#step:9:59)| 
     59|     expect(samoaTime).toBeDefined();
     60|     expect(samoaTime.title).toEqual(
       |                             ^
     [61](https://github.com/apache/airflow/actions/runs/11399466779/job/31718337427?pr=43084#step:9:62)|       dayjs().tz("UTC").format(defaultFormatWithTZ),
     [62](https://github.com/apache/airflow/actions/runs/11399466779/job/31718337427?pr=43084#step:9:63)|     );

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed | 7 passed (8)
      Tests  1 failed | 18 passed (19)
   Start at  07:34:15
   Duration  4.17s (transform 414ms, setup 8[71](https://github.com/apache/airflow/actions/runs/11399466779/job/31718337427?pr=43084#step:9:72)ms, collect 5.22s, tests 810ms, environment 2.58s, prepare 829ms)

What you think should happen instead?

The test should pass.

How to reproduce

Intermittent failure, so difficult to reproduce.

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:CIAirflow's tests and continious integrationarea:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions