google / go-cloud

The Go Cloud Development Kit (Go CDK): A library and tools for open cloud development in Go.
https://gocloud.dev/
Apache License 2.0
9.45k stars 799 forks source link

fix(docstore/awsdynamodb): ensure Next returns EOF when no more items #3406

Closed bartventer closed 3 months ago

bartventer commented 3 months ago

Fixes #3405

Although I was unable to reproduce the panic, I added a preventive check for awsdynamodb here. This check returns io.EOF if there are no more items, which should prevent an index out of range panic when Next is called after it has already returned EOF once.

I also added a test case to verify this behavior. The test repeatedly calls Next until it gets io.EOF, then calls Next again to ensure it still returns io.EOF.

I also generated new replay files for awsdynamodb and gcpfirestore.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 73.12%. Comparing base (1f3e996) to head (daa25e8).

Files Patch % Lines
docstore/awsdynamodb/query.go 0.00% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3406 +/- ## ========================================== - Coverage 73.13% 73.12% -0.01% ========================================== Files 113 113 Lines 14862 14864 +2 ========================================== Hits 10870 10870 - Misses 3218 3219 +1 - Partials 774 775 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.