Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Nov 29, 2024
1 parent 6b04e88 commit f1b14a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dagfactory/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TELEMETRY_URL = "https://astro.gateway.scarf.sh/{telemetry_version}/{dagfactory_version}/{airflow_version}/{python_version}/{platform_system}/{platform_machine}/{event_type}/{status}/{dag_hash}/{task_count}"
TELEMETRY_URL = "https://astronomer.gateway.scarf.sh/{telemetry_version}/{dagfactory_version}/{airflow_version}/{python_version}/{platform_system}/{platform_machine}/{event_type}/{status}/{dag_hash}/{task_count}"
TELEMETRY_VERSION = "v1"
TELEMETRY_TIMEOUT = 5.0
5 changes: 3 additions & 2 deletions tests/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ def test_emit_usage_metrics_fails(mock_httpx_get, caplog):
}
is_success = telemetry.emit_usage_metrics(sample_metrics)
mock_httpx_get.assert_called_once_with(
"https://astro.gateway.scarf.sh/v1/0.2.0a1/2.10.1/3.11/darwin/amd64/dag_run/success/d151d1fa2f03270ea116cc7494f2c591/3",
"https://astronomer.gateway.scarf.sh/v1/0.2.0a1/2.10.1/3.11/darwin/amd64/dag_run/success/d151d1fa2f03270ea116cc7494f2c591/3",
timeout=5.0,
follow_redirects=True,
)
assert not is_success
log_msg = "Unable to emit usage metrics to https://astro.gateway.scarf.sh/v1/0.2.0a1/2.10.1/3.11/darwin/amd64/dag_run/success/d151d1fa2f03270ea116cc7494f2c591/3. Status code: 404. Message: Non existent URL"
log_msg = "Unable to emit usage metrics to https://astronomer.gateway.scarf.sh/v1/0.2.0a1/2.10.1/3.11/darwin/amd64/dag_run/success/d151d1fa2f03270ea116cc7494f2c591/3. Status code: 404. Message: Non existent URL"
assert caplog.text.startswith("WARNING")
assert log_msg in caplog.text

Expand Down

0 comments on commit f1b14a6

Please sign in to comment.