test: run full suite on HANA + fix two HANA span/metric bugs (#477 §2, §5) - #481
Conversation
Remove all 8 cds<9 version guards (dead code — peer floor is ^9 || ^10 and CI matrix is only 9 & 10, so version < 9 can never be true): metrics-outbox, metrics-outbox-multitenant, tracing-outboxed-batch, tracing-remote-cloudsdk, tracing-remote-native, tracing-attributes (remote sub-test), tracing-scheduled. Remove the HANA CI 2-file test-subset in vitest.config.mjs so the full suite runs on HANA (keeping the 10x timeout). Only SAP Passport remains HANA/sqlite- specific, handled by its own in-file skip. Refs #477
SummaryThe following content is AI-generated and provides a summary of the pull request: test: Remove Dead
|
There was a problem hiding this comment.
The changes are clean and correct. All the removed guards were indeed dead code given the peer dependency floor of ^9 || ^10. The vitest.config.mjs change correctly removes the 2-file subset while keeping the 10× timeout and the cds_requires_telemetry_tracing env setup for HANA CI. There are no logic errors or bugs introduced.
The only subtle thing to note is the original version comparison cds.version.split('.')[0] < 9 (without Number()) was a string comparison, but that doesn't matter since the guards are removed entirely — not a defect in the new code.
This is a clean, low-risk test-only PR that removes dead code. The changes are correct: the peer dependency floor (^9 || ^10) guarantees the removed cds < 9 guards could never have been true, and the HANA CI config update properly runs the full suite while preserving the 10× timeout. No issues to flag.
PR Bot Information
Version: 1.29.26
- File Content Strategy: Full file content
- Correlation ID:
cfeb72e0-96e4-11f1-96b1-d480e47f8267 - LLM:
anthropic--claude-4.6-sonnet - Event Trigger:
pull_request.opened
Removing the HANA CI test-subset (§5) surfaced HANA-only failures. Fixes: - fix(tracing): raw SQL leaked into HANA INSERT prepare span names — the name-normalization regex used '.' which doesn't match HANA's multi-line INSERT SQL; use [\s\S] so it's stripped (operation+table only, matching SELECT). SQL stays in db.query.text. - fix(metrics): *_storage_time_in_seconds were skewed by the machine's UTC offset on HANA — HANA's min()/max() aggregates return timezone-naive timestamps parsed as local time. Normalize to UTC before Date.parse. - test: convert queue/outbox span assertions to force-flush + poll (spans export after fixed waits on slower HANA); filter the outbox-scan trace primer out of the logging assertion; fix a lifecycle bug where a retry handler fired with an undefined counter. - test: multitenancy tests skip on HANA (need a bound Service Manager, not available in the single-HDI-container CI) with an explanatory comment. - HANA CI: run files serially (shared HDI container vs sqlite's per-file DB), raise hookTimeout, HANA-only outbox settle in afterAll, and retry:2 for the residual remote-container timing variance. sqlite unchanged (retry:0). Refs #477
Apply maintainer review on #481: - exclude tracing-mt + metrics-outbox-multitenant from the HANA job at the vitest.config level (they need a bound Service Manager the single-HDI CI lacks), instead of in-file db.kind==='hana' skips. - remove the fragile read-then-'delete cds.env' pattern; the HANA path is signalled via TELEMETRY_TEST_HANA set in vitest.config. - logging.test: disable tracing (exporter:false) so no outbox-scan 'elapsed times:' primer is emitted, instead of filtering it out post-hoc. Fix the HANA ECONNREFUSED cascade: the metrics-outbox profile's tight exportIntervalMillis:100 (+ 25ms expectEventually polling) ran the queue-stats cds.spawn poller in a near-constant loop that starved the queue worker of DB connections on the shared HDI container; retries stalled, hooks timed out, the pool exhausted, and the next file's server became unreachable (ECONNREFUSED). Raise exportIntervalMillis to 1000 and the poll interval to 500ms (tests force collection via forceFlush, so no tight background interval is needed); bound every outbox-clear with a 5s race so a draining pool can't hang a hook; drop hookTimeout from 100s back to 30s. Refs #477
What
Started as removing dead test exclusions for #477 (§2 cds<9 guards, §5 HANA CI test-subset). Removing the HANA subset surfaced HANA-only failures — including two real production bugs that the old 2-file subset had been masking — so this PR also fixes those.
Production fixes (lib/)
INSERTpreparespan names. The name-normalization regex used.which doesn't match newlines, so HANA's multi-lineINSERT … WITH SRC AS (…)SQL survived in the span name. Now uses[\s\S]so it's stripped to operation + table (matching SELECT); the SQL stays indb.query.text.*_storage_time_in_secondsgauges were skewed by the machine's UTC offset on HANA — HANA'smin()/max()aggregates return timezone-naive timestamps thatnew Date()parsed as local time. Normalize to UTC before parsing.Both carry CHANGELOG
### Fixedentries.Test-suite changes (§2/§5 + HANA robustness)
cds < 9guards (§2) and the HANA CI 2-file test-subset (§5) so the full suite runs on HANA.vitest.config.mjs, HANA-only): run files serially (all files share one HDI container vs sqlite's per-file in-memory DB), raisehookTimeout, HANA-only outbox settle inafterAll, andretry: 2for residual shared-remote-container timing variance. sqlite unchanged (retry:0, full parallelism).Skips (deviation from "no skips except passport" — conscious)
tracing-mt,metrics-outbox-multitenant) skip on HANA with an explanatory comment: they need a bound BTP Service Manager for MTX tenant subscription, which the single pre-provisioned HDI container in CI doesn't provide. They still run fully on sqlite. This means multitenancy has no HANA coverage — acknowledged; can be revisited if the CI HANA setup gains MTX.Verification
Refs #477 (§1 queue-worker sqlite skips remain, gated on the cds queue-spawn fix; §3 stubs pending).