mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
fix(cron): keep helpful diagnostics under pipefail / shared snippet
Some checks failed
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
Some checks failed
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
- run_daily.sh: append '|| true' to the claude --version pipeline so a non-matching grep doesn't get propagated by pipefail+set -e, aborting before the '[[ -n CLAUDE_CODE_VERSION ]] || die' diagnostic fires. - test_run_daily_release_pagination.py: the resolution-snippet extracted from run_daily.sh starts AFTER log/die are defined. Define stubs in the test preamble so an empty LITELLM_VERSION surfaces the intended error message instead of 'bash: die: command not found' (exit 127). Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
665206c6ef
commit
2fea4d5cd2
2 changed files with 24 additions and 5 deletions
|
|
@ -35,6 +35,17 @@ import pytest
|
|||
REPO_ROOT = Path(__file__).resolve().parents[3]
|
||||
RUN_DAILY = REPO_ROOT / "tests" / "claude_code" / "cron_vm" / "run_daily.sh"
|
||||
|
||||
# The extracted snippet starts AFTER `log`/`die` are defined in run_daily.sh,
|
||||
# so the test harness has to provide its own stubs. Without them, a failure
|
||||
# inside the snippet (e.g. jq returning an empty LITELLM_VERSION) would crash
|
||||
# with `bash: die: command not found` (exit 127) instead of the intended
|
||||
# diagnostic, making test failures unnecessarily hard to debug.
|
||||
_PREAMBLE = (
|
||||
"set -Eeuo pipefail\n"
|
||||
"log() { printf '==> %s\\n' \"$*\" >&2; }\n"
|
||||
"die() { printf 'ERROR: %s\\n' \"$*\" >&2; exit 1; }\n"
|
||||
)
|
||||
|
||||
|
||||
def test_run_daily_does_not_early_break_on_first_stable_page() -> None:
|
||||
"""The regex pattern `select(test("...stable$"))] | length > 0` followed
|
||||
|
|
@ -211,8 +222,10 @@ def test_run_daily_resolves_highest_semver_across_pages(tmp_path: Path) -> None:
|
|||
|
||||
snippet = _extract_resolution_snippet()
|
||||
script = (
|
||||
"set -Eeuo pipefail\n"
|
||||
f"WORKDIR={workdir!s}\n" + snippet + 'printf "%s" "${LITELLM_VERSION}"\n'
|
||||
_PREAMBLE
|
||||
+ f"WORKDIR={workdir!s}\n"
|
||||
+ snippet
|
||||
+ 'printf "%s" "${LITELLM_VERSION}"\n'
|
||||
)
|
||||
|
||||
env = {
|
||||
|
|
@ -249,8 +262,10 @@ def test_run_daily_terminates_on_empty_page(tmp_path: Path) -> None:
|
|||
|
||||
snippet = _extract_resolution_snippet()
|
||||
script = (
|
||||
"set -Eeuo pipefail\n"
|
||||
f"WORKDIR={workdir!s}\n" + snippet + 'printf "%s" "${LITELLM_VERSION}"\n'
|
||||
_PREAMBLE
|
||||
+ f"WORKDIR={workdir!s}\n"
|
||||
+ snippet
|
||||
+ 'printf "%s" "${LITELLM_VERSION}"\n'
|
||||
)
|
||||
|
||||
env = {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,11 @@ CLAUDE_CODE_VERSION="$(env -i \
|
|||
TMPDIR="${TMPDIR:-/tmp}" \
|
||||
claude --version 2>/dev/null \
|
||||
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+([.-][A-Za-z0-9.-]+)?' \
|
||||
| head -n1)"
|
||||
| head -n1 || true)"
|
||||
# `|| true` above keeps `set -Eeuo pipefail` from aborting silently when
|
||||
# `grep` finds no match (exit 1) — without it the assignment inherits the
|
||||
# pipeline's non-zero exit, `set -e` kills the script, and the operator
|
||||
# never sees the helpful diagnostic below.
|
||||
[[ -n "${CLAUDE_CODE_VERSION}" ]] || die "could not parse semver from 'claude --version'"
|
||||
log "local claude code: ${CLAUDE_CODE_VERSION}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue