You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/05/10 16:52:37 UTC

[PR] Fix flaky databricks token-expiry test by freezing time_machine [airflow]

potiuk opened a new pull request, #66660:
URL: https://github.com/apache/airflow/pull/66660

   ## Summary
   
   The Compat 3.0.6 ARM scheduled run failed on `test_get_federated_token_with_projected_volume` ([job link](https://github.com/apache/airflow/actions/runs/25630609385/job/75234213072)) with an off-by-one on the expected token expiry timestamp:
   
   \`\`\`
   assert hook.oauth_tokens[resource]["expires_on"] == expiry_date
   E   assert 1752325201 == 1752325200
   \`\`\`
   
   ## Root cause
   
   The test sets up a static expected via:
   \`\`\`python
   int((datetime(2025, 7, 12, 12, 0, 0) + timedelta(minutes=60)).timestamp())
   \`\`\`
   while the production code under test computes:
   \`\`\`python
   int(time.time() + jsn["expires_in"])
   \`\`\`
   
   `@time_machine.travel("2025-07-12 12:00:00")` defaults to `tick=True`, so the patched clock keeps advancing during the test. By the time `time.time()` is sampled the float has crept past the travel anchor by enough that `int(...)` rounds up by one second, and the assertion blows up.
   
   ## Fix
   
   Add `tick=False` to **every** `time_machine.travel(...)` decorator in `providers/databricks/tests/unit/databricks/hooks/test_databricks_base.py` (20 sites). Only one is failing today, but the other 19 share the exact same race — each is one slow CI run away from the same flake.
   
   No production-code change.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code) (Opus 4.7, 1M context)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix flaky databricks token-expiry test by freezing time_machine [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #66660:
URL: https://github.com/apache/airflow/pull/66660


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org