Skip to content

Commit

Permalink
Fix integration test and bug in load balancer wait logic (#85)
Browse files Browse the repository at this point in the history
I noticed that sometimes dag.test() does not raise an exception even when an Airflow task fails, leading to silent failures in CI jobs without any notification. To address this, I’ve added an explicit assertion to check that the DAG run state is "success" when dag.test() does not raise an exception.

Added the tool.pytest.ini_options section in pyproject.toml, including the minversion option and custom markers.

Fixed bug in the sleep logic while waiting for the load balancer to become ready

Failed detected CI: https://github.com/astronomer/astro-provider-ray/actions/runs/11560564529/job/32177695161?pr=85

closes: astronomer/oss-integrations-private#22
  • Loading branch information
pankajastro authored Oct 29, 2024
1 parent 0d99128 commit b6fe51b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ test-cov = 'sh scripts/test/unit_cov.sh'
test-integration = 'sh scripts/test/integration_test.sh'
static-check = "pre-commit run --all-files"

[tool.pytest.ini_options]
filterwarnings = ["ignore::DeprecationWarning"]
minversion = "6.0"
markers = ["integration"]

######################################
# DOCS
######################################
Expand Down
1 change: 1 addition & 0 deletions ray_provider/hooks/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def _wait_for_load_balancer(

if not lb_details:
self.log.info("LoadBalancer details not available yet.")
time.sleep(retry_interval)
continue

working_address = self._check_load_balancer_readiness(lb_details)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_dag_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_dag_runs(setup_airflow_db, dag_id, dag, fileloc):
return

try:
dag.test()
dr = dag.test()
assert dr.state == "success"
except Exception as e:
pytest.fail(f"Error running DAG {dag_id}: {e}")

0 comments on commit b6fe51b

Please sign in to comment.