Skip to content

Update stream deletion assertions for the new async DELETE contract - #126

Open
prabhaks wants to merge 1 commit into
parseablehq:mainfrom
prabhaks:update-tests-for-async-stream-deletion
Open

Update stream deletion assertions for the new async DELETE contract#126
prabhaks wants to merge 1 commit into
parseablehq:mainfrom
prabhaks:update-tests-for-async-stream-deletion

Conversation

@prabhaks

Copy link
Copy Markdown

Summary

Companion to parseablehq/parseable#1770, which makes stream deletion asynchronous:

  • DELETE /logstream/{stream} now returns 202 Accepted instead of 200 OK, since the actual deletion runs in the background rather than blocking the response.
  • Recreating a stream immediately after deleting it can now return 409 Conflict ("being deleted, please retry shortly") instead of succeeding right away, if the old stream's background deletion hasn't finished yet.

Without this update, essentially every test in this suite that deletes and recreates a stream as part of its own setup/teardown (a very common pattern here) fails, either directly on the DeleteStream assertion or on a CreateStream* call racing the still-in-flight deletion of a same-named stream from a prior test. See the CI logs on parseable#1770 for the concrete failures this caused.

Changes

  • DeleteStream now expects 202 instead of 200.
  • CreateStream, CreateStreamWithHeader, CreateStreamWithCustompartitionError, and CreateStreamWithSchemaBody now retry (bounded to 15s, 200ms between attempts) while the server returns 409, via a small shared doWithRetryOn409 helper, instead of asserting on the first response. This means no changes are needed at the dozens of individual call sites that already assume DeleteStream followed by CreateStream* just works.
  • One inline DELETE assertion in checkAPIAccess (the RBAC "editor" case, which should succeed) updated from 200 to 202; the 403 cases (writer/reader/ingestor, correctly denied) are unaffected.

Test plan

No test-runner CI is configured for PRs in this repo (only a push-to-main Docker publish), and running the actual suite requires a live Parseable cluster. Verified instead with a local Go 1.21 toolchain:

  • go build ./...
  • go vet ./...
  • go test -c ./... (compiles the test binary exactly as the Dockerfile's own go test -c step does)
  • gofmt -l . (clean)

Once parseable#1770 is available to test against (e.g. via a locally built image), running this suite's TestDeleteStream, TestSmokeCreateStream, TestSmokeListLogStream, and TestSmokeGetAlert/TestSmokeSetRetention/TestSmokeGetRetention would confirm the fix end to end.

parseablehq/parseable#1770 makes DELETE /logstream/{stream} return 202
Accepted instead of 200 OK, since deletion now runs in the background
rather than blocking the response. It also makes recreating a stream
immediately after deleting it return 409 while the old stream's
deletion is still in flight, instead of succeeding right away.

Updates DeleteStream to expect 202, and adds a bounded retry-on-409 to
the stream creation helpers so tests that delete and immediately
recreate the same stream name (a common setup/teardown pattern here)
keep working without needing changes at every call site.
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