Loading
test(v2/featureflag): add integration tests for timeout fallback behaviour
What this MR does
Adds v2/featureflag/timeout_test.go with two integration tests that verify the HTTP timeout fallback path end-to-end:
TestBooleanValueDetails_ReturnsFallbackOnServerTimeout— starts anhttptest.Serverthat accepts connections but never writes a response (simulating a hung Flipt service), creates a client with a 100 ms timeout, callsBooleanValueDetails, and asserts:- the default flag value is returned
- an error is returned (for caller observability)
- evaluation completes within
timeout × 10(does not hang) - the OTel span records the failure
TestStringValueDetails_ReturnsFallbackOnServerTimeout— same pattern forStringValueDetails
Why
Closes criterion 5 of team-tasks#4382: "Behaviour is validated under simulated slow/unresponsive feature flag service conditions".
The existing transport_test.go unit-tests resolveHTTPClient in isolation. These new tests provide end-to-end confidence that the 2 s default timeout propagates correctly through the Flipt provider → HTTP client → caller path.
How to test
cd v2 && go test ./featureflag/ -run "Timeout" -vAll 40 tests in the package pass.
Checklist
- Tests added
- All existing tests pass (
go test ./featureflag/...) - No production code changes