Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This change improves the unit test coverage of the memorystore package, specifically focusing on the InMemoryPubSub implementation and the integration/fallback logic in MemoryStore. It addresses potential race conditions in Unsubscribe and ensures that edge cases like double Close and invalid GCP configuration are handled correctly. Basic tests for GCPPubSub initialization were also added.


PR created automatically by Jules for task 17196759260958987967 started by @BryceWayne

- Updated `memorystore/pubsub_memory.go` to handle unsubscription cleanup asynchronously, preventing potential race conditions and improving testability.
- Added `memorystore/memorystore_extra_test.go` to cover `SubscriberCount`, `initPubSub` fallback, and `SetJSON` error handling.
- Added `memorystore/pubsub_memory_test.go` tests for `Close` (idempotency) and `removeSubscription` edge cases.
- Added `memorystore/pubsub_gcp_test.go` to verify basic GCP PubSub client initialization failure paths without requiring credentials.
- Verified all tests pass with `-race`.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@BryceWayne
Copy link
Owner

The build failed. Check why the ci cd failed

@google-labs-jules
Copy link
Contributor Author

The build failed. Check why the ci cd failed

I have investigated the build failure and identified that it was likely due to a linting error in the new test file. Specifically, the error return value of ms.Unsubscribe was not checked in a defer statement. I have corrected this by wrapping it in a function and explicitly ignoring the error, as is standard practice for defer cleanup in tests. I also ran gofmt to ensure proper formatting.

- Fixed `errcheck` linter error in `memorystore_extra_test.go` by explicitly ignoring the return value of `ms.Unsubscribe` in a `defer` block.
- Applied `gofmt` to `memorystore/memorystore_extra_test.go`, `memorystore/pubsub_gcp_test.go`, and `memorystore/pubsub_memory_test.go` to ensure consistent code style.
@BryceWayne BryceWayne marked this pull request as ready for review January 5, 2026 05:48
@BryceWayne BryceWayne merged commit b1e1106 into root Jan 5, 2026
1 check passed
@BryceWayne BryceWayne deleted the unit-tests-coverage-17196759260958987967 branch January 5, 2026 05:48
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