Repository navigation
Conversation
| out, _ = capsys.readouterr() | ||
| assert "Job finished successfully" in out | ||
| finally: | ||
| teardown() |
There was a problem hiding this comment.
All we're doing is adding:
finally:
teardown()
| out, _ = capsys.readouterr() | ||
| assert "Job finished successfully" in out | ||
| finally: | ||
| teardown() |
There was a problem hiding this comment.
All we're doing is adding:
finally:
teardown()
There was a problem hiding this comment.
Code Review
This pull request wraps Dataproc cluster creation, job submission, and teardown in a try...finally block within the test functions to ensure cleanup. However, because these test functions are decorated with @backoff.on_exception, any transient failure during job submission will trigger the finally block (deleting the cluster) and then recreate the cluster on retry. Since cluster operations are slow, this can cause test timeouts. It is recommended to use a module-scoped pytest fixture to handle cluster setup and teardown, ensuring the cluster is created once and only the job submission is retried.
|
|
||
|
|
||
| @backoff.on_exception(backoff.expo, (Exception), max_tries=5) | ||
| def teardown(): |
There was a problem hiding this comment.
This teardown() doesn't actually get triggered by pytest.
|
If this PR becomes stale (i.e., a few months old), I suggest closing this PR entirely since the tests are disabled anyway. |
Description
Checklist
Testing
To verify that this works, please see the Dataproc clusters at: https://console.cloud.google.com/dataproc/clusters
You'll find the project ID in the internal bug: b/582098748
Compliance & Style
Post-Approval Actions