Skip to content

Commit

Permalink
fix(proto): also ensure allocated key matches
Browse files Browse the repository at this point in the history
Ensure that the protocolBody we got back from allocateBody matches the
apiversion key that we asked for

Signed-off-by: Dominic Evans <[email protected]>
  • Loading branch information
dnwe committed Aug 1, 2023
1 parent 70d2c11 commit da76e28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ func TestAllocateBodyVersions(t *testing.T) {
resp := allocateResponseBody(req)
assert.NotNil(t, resp, fmt.Sprintf("%s has no matching response type in allocateResponseBody", reflect.TypeOf(req)))
for _, body := range []protocolBody{req, resp} {
assert.Equal(t, key, body.key())
assert.Equal(t, version, body.version())
assert.True(t, body.isValidVersion(), fmt.Sprintf("%s v%d is not supported", reflect.TypeOf(body), version))
assert.True(t, body.isValidVersion(), fmt.Sprintf("%s v%d is not supported, but expected for KafkaVersion %s", reflect.TypeOf(body), version, tt.version))
assert.True(t, tt.version.IsAtLeast(body.requiredVersion()), fmt.Sprintf("KafkaVersion %s should be enough for %s v%d", tt.version, reflect.TypeOf(body), version))
}
})
Expand Down

0 comments on commit da76e28

Please sign in to comment.