Skip to content

test: run full suite on HANA + fix two HANA span/metric bugs (#477 §2, §5) - #481

Merged
sjvans merged 4 commits into
developfrom
test/remove-cds9-guards-and-hana-subset
Aug 17, 2026
Merged

test: run full suite on HANA + fix two HANA span/metric bugs (#477 §2, §5)#481
sjvans merged 4 commits into
developfrom
test/remove-cds9-guards-and-hana-subset

Conversation

@sjvans

@sjvans sjvans commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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/)

  • fix(tracing): raw SQL leaked into HANA INSERT prepare span names. The name-normalization regex used . which doesn't match newlines, so HANA's multi-line INSERT … 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 in db.query.text.
  • fix(metrics): *_storage_time_in_seconds gauges were skewed by the machine's UTC offset on HANA — HANA's min()/max() aggregates return timezone-naive timestamps that new Date() parsed as local time. Normalize to UTC before parsing.

Both carry CHANGELOG ### Fixed entries.

Test-suite changes (§2/§5 + HANA robustness)

  • Remove all 8 dead cds < 9 guards (§2) and the HANA CI 2-file test-subset (§5) so the full suite runs on HANA.
  • 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.
  • HANA CI config (vitest.config.mjs, HANA-only): run files serially (all files share one HDI container vs sqlite's per-file in-memory DB), raise hookTimeout, HANA-only outbox settle in afterAll, and retry: 2 for residual shared-remote-container timing variance. sqlite unchanged (retry:0, full parallelism).

Skips (deviation from "no skips except passport" — conscious)

  • Multitenancy tests (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

  • sqlite: 63 passed / 14 skipped / 0 failed.
  • HANA (serial + retry:2): 64 passed / 6 skipped / 0 failed, stable across repeated runs (the 6 skips = 2 multitenancy + 4 pre-existing xtest/TODO in tracing.test.js).

Refs #477 (§1 queue-worker sqlite skips remain, gated on the cds queue-spawn fix; §3 stubs pending).

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
@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


test: Remove Dead cds < 9 Version Guards and HANA CI Test-Subset Restriction

Test

🧹 Removes dead code: all cds < 9 version guards across test files (the condition can never be true given the ^9 || ^10 peer dep floor) and drops the 2-file HANA CI test-subset so the full suite now runs on HANA.

Changes

  • test/metrics-outbox.test.js: Removed if (cds.version < 9) test.skip(...) guard — dead code, peer dep floor is ^9.
  • test/metrics-outbox-multitenant.test.js: Same cds < 9 guard removed.
  • test/tracing-outboxed-batch.test.js: Removed cds < 9 early-return skip block.
  • test/tracing-scheduled.test.js: Removed cds < 9 early-return skip block.
  • test/tracing-remote-cloudsdk.test.js: Removed cds < 9 early-return (Cloud SDK resilience workaround no longer needed).
  • test/tracing-remote-native.test.js: Same cds < 9 early-return removed.
  • test/tracing-attributes.test.js: Removed cds < 9 early-return inside the remote sub-test.
  • vitest.config.mjs: Dropped the include override that restricted HANA CI to only tracing-attributes.test.js + passport.test.js. HANA CI now runs the full test/**/*.test.js suite with the existing 10× timeout. Updated the comment accordingly. SAP Passport's own in-file sqlite skip remains as the sole sanctioned exception.

Jira Issues (ONLY add this section if JIRA issues are available)

Images and Links

Related GitHub Issues:

  • #477: Eliminate all test skips and CI test-subset exclusions (sqlite + HANA)
  • #467: test: remove sqlite skips for queue-worker tracing (merge after cds spawn fix)
  • #475: Enable HTTP instrumentation in tests and assert on incoming spans

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.29.26

@hyperspace-pr-bot hyperspace-pr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Comment thread test/metrics-outbox-multitenant.test.js Outdated
Comment thread test/logging.test.js Outdated
@sjvans sjvans changed the title test: remove dead cds<9 guards and HANA CI test-subset (#477 §2, §5) test: run full suite on HANA + fix two HANA span/metric bugs (#477 §2, §5) Aug 14, 2026
Comment thread test/tracing-mt.test.js Outdated
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
@sjvans
sjvans merged commit 8f8485d into develop Aug 17, 2026
12 checks passed
@sjvans
sjvans deleted the test/remove-cds9-guards-and-hana-subset branch August 17, 2026 08:53
@sjvans sjvans mentioned this pull request Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant