youngoli commented on a change in pull request #11413: [BEAM-9746] check for 0 
length copies from state
URL: https://github.com/apache/beam/pull/11413#discussion_r408481881
 
 

 ##########
 File path: sdks/go/pkg/beam/core/runtime/harness/statemgr_test.go
 ##########
 @@ -258,6 +261,167 @@ func TestStateChannel(t *testing.T) {
        }
 }
 
+// TestStateKeyReader validates ordinary Read cases
+func TestStateKeyReader(t *testing.T) {
+       const readLen = 4
+       tests := []struct {
+               name     string
+               buflens  []int // sizes of the buffers received on the state 
channel.
+               numReads int
 
 Review comment:
   Is the number of reads something that needs to be predictable to whatever 
code uses the reader? To me it seems like one of those implementation details 
that doesn't need to be unit tested because it's invisible to the caller.
   
   The reason this stood out to me is that the `numReads` in all the test cases 
below seem a bit inscrutable, and it would cause these tests to fail if the 
implementation of the `stateKeyReader` was changed slightly, which is just an 
annoyance unless it would actually break code.
   
   On the other hand, if the number of reads _is_ a detail that users should 
know, and correctness does rely on it staying consistent, that seems like it 
should be explicitly documented on `stateKeyReader.Read`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to