Skip to content

chore: port long-running test framework support from v3 - #428

Merged
tanderson-ld merged 1 commit into
v2from
ta/port-long-running-framework-to-v2
Aug 18, 2026
Merged

chore: port long-running test framework support from v3#428
tanderson-ld merged 1 commit into
v2from
ta/port-long-running-framework-to-v2

Conversation

@tanderson-ld

@tanderson-ld tanderson-ld commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports the framework scaffolding portion of launchdarkly/sdk-test-harness#314 (Jason Bailey, "fix: Add support for optional long running tests") from v3 to v2.

What ships

  • -enable-long-running-tests CLI flag (default false). Mirrors the -enable-persistence-tests shape.
  • EnableLongRunningTests bool on ldtest.TestConfiguration.
  • (t *T) LongRunning() method. Long-running tests call it at the top of their body; if the flag isn't set, the test skips with reason "use -enable-long-running-tests to run".
  • Threaded through RunSDKTestSuite and main.go.

What's deliberately not ported

The original commit (01a245c) also added 237 lines to sdktests/common_tests_stream_fdv2.go. That file exercises v3-only FDv2 shapes and has no place on v2. Skipped.

Why now

Scaffolding for follow-up work on #404. Review feedback there (discussion, discussion) argued against exposing an SDK-side servicedef knob to compress the extended-regime timing in the RETRY-conformance tests. The consensus was that those tests should run at real timing gated by the long-running-tests mechanism — which requires that mechanism to exist on v2 first.

Once this lands, #404 rebases onto v2 tip and its RETRY-conformance tests get t.LongRunning() calls at the top of their bodies, plus timing rewritten to production defaults.

Verification

  • go build ./... — clean.
  • go run . -h — new flag visible: -enable-long-running-tests enable tests that take a long time to run (10+ seconds).
  • go test ./... — full suite green. No behavior change to existing v2 tests since none of them call t.LongRunning().

Test plan


Note

Overview
Adds optional long-running test gating on v2, mirroring the existing -enable-persistence-tests pattern.

The harness accepts -enable-long-running-tests (default false). That value flows through mainRunSDKTestSuiteldtest.TestConfiguration.EnableLongRunningTests. Tests can call t.LongRunning() at the start; when the flag is off they skip with reason use -enable-long-running-tests to run.

No existing v2 tests call LongRunning() yet, so default runs behave the same until follow-up tests adopt the helper.

Reviewed by Cursor Bugbot for commit 536af50. Bugbot is set up for automated code reviews on this repo. Configure here.

Cherry-picks the framework scaffolding portion of
#314 (Jason Bailey) from v3 to v2.

Adds:
- `-enable-long-running-tests` CLI flag (default false), mirroring the
  `-enable-persistence-tests` shape.
- `EnableLongRunningTests bool` on `ldtest.TestConfiguration`.
- `(t *T) LongRunning()` method — long-running tests call this at the
  top of their body; if the flag isn't set, the test skips with reason
  "use -enable-long-running-tests to run".
- Threaded through `RunSDKTestSuite` and `main.go`.

Deliberately excluded from the port: the v3-specific FDv2 stream tests
that came in the same original commit (`sdktests/common_tests_stream_fdv2.go`).
Those exercise v3-only shapes.

No behavior change to existing v2 tests -- none of them currently call
`t.LongRunning()`. This is scaffolding for follow-up work: the RETRY-
conformance tests in #404 will migrate
their timing-compression-via-servicedef approach to real timing gated
by this flag, per the review feedback that argued against exposing
SDK-side test-harness bypasses.
@tanderson-ld
tanderson-ld requested a review from a team as a code owner August 18, 2026 13:57
@tanderson-ld
tanderson-ld merged commit 7716191 into v2 Aug 18, 2026
9 checks passed
@tanderson-ld
tanderson-ld deleted the ta/port-long-running-framework-to-v2 branch August 18, 2026 14:09
tanderson-ld added a commit that referenced this pull request Aug 19, 2026
…ling (#404)

## Summary

Adds contract tests exercising the RETRY specification's
non-permanent-stop guarantee for the FDv1 streaming and polling data
sources. Introduces two capability gates so SDKs can adopt
independently:

- `retry-conformance-fdv1-streaming`
- `retry-conformance-fdv1-polling`

The new tests exercise the SDK's real production 5-minute
extended-regime timing — no test-harness bypass, no compression knobs on
the servicedef, no test-only surface in the SDK's public API. They are
marked as long-running (`t.LongRunning()`) and only run when the harness
is invoked with `-enable-long-running-tests`.

Legacy "do not retry after unrecoverable HTTP error" scenarios remain,
gated behind the ABSENCE of the streaming capability so SDKs can migrate
on their own schedule. Once every SDK reports the new capabilities, both
the legacy tests and the gates can be removed.

## What's added

**Streaming (guarded by `retry-conformance-fdv1-streaming` +
`-enable-long-running-tests`):**
- retry after unexpected HTTP error on initial connect (401/403/405)
- retry after unexpected HTTP error on reconnect (401/403/405)
- enters extended-regime backoff after unexpected HTTP error
(paired-bound timing assertion)
- does not permanently stop under sustained unexpected HTTP errors
- returns to normal-regime backoff after healthy operation (streaming
spec's activeSince reset: 75 s silent stream after an extended-regime
reconnect, then next reconnect must be at normal-regime timing)

**Polling (guarded by `retry-conformance-fdv1-polling` +
`-enable-long-running-tests`):**
- retry after unexpected HTTP error on initial poll (401/403/405)
- returns to normal-regime cadence after two consecutive successful
polls (RETRY §1.8.1 count-based reset)

## Design: long-running instead of compressed timings

An earlier revision of this PR exposed extended-regime timing knobs on
the servicedef (`ExtendedInitialDelayMS`, `ResetThresholdMS`) so tests
could compress the 5-minute extended-initial delay into a ~30-second
observable window. Reviewers pushed back because that shape forced SDKs
to expose corresponding test-only knobs on their public API surface just
to be testable by the harness.

This revision drops all compression knobs and exercises real production
timing instead. That makes each retry-conformance subtest take several
minutes of wall clock, which is why the tests are marked
`t.LongRunning()` and gated behind `-enable-long-running-tests`. Per-SDK
CI schedules for the long-running suite are out of scope for this PR
(planned follow-up work).

Framework support for `t.LongRunning()` and the
`-enable-long-running-tests` flag was ported from v3 in #428, a
prerequisite that landed before this PR's refactor.

## Relationship to PR #401

Supersedes #401, which targeted `v3` and exercised FDv2 code paths — out
of scope for the initial RETRY-conformance work, which is FDv1-only.
This PR targets `v2` and drives the FDv1 streaming/polling paths in the
SDK testservices. #401 will be closed with a pointer here.

SDK-2808

## Test plan
- [x] Contract tests pass against go-server-sdk PR #429 (the reference
server SDK implementation) at real production 5-minute extended-regime
timing (~3-hour run with `-enable-long-running-tests`)
- [x] Legacy "do not retry" tests still pass for SDKs without the new
capability (verified by SDK capability check)
- [x] Retry-conformance tests are correctly SKIPPED for SDKs without the
capability
- [x] Retry-conformance tests are correctly SKIPPED when
`-enable-long-running-tests` is not set
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.

2 participants