chore: Clarify GrantHash behavior when there are no GrantTuples (#5334)
* chore: Simplify appending * test(grants): De-dupe hash comparison * chore(grants): Remove TODO & add clarifying comment * test(grants): Add test cases to enforce empty grants behavior
This commit is contained in:
1 parent
c32dcecb6e
commit
f62e67584e
3 files changed
+25
-5
No files matched your search
@@ -341,5 +341,14 @@ func TestGrantsHash(t *testing.T) {
|
||||
hash3, err := res.GrantsHash(ctx)
|
||||
require.NoError(t, err)
|
||||
assert.False(t, bytes.Equal(hash1, hash3))
|
||||
assert.False(t, bytes.Equal(hash1, hash3))
|
||||
assert.False(t, bytes.Equal(hash2, hash3))
|
||||
|
||||
// Recreate auth result with no grants, should return a slice of empty bytes
|
||||
res.grants = nil
|
||||
hash4, err := res.GrantsHash(ctx)
|
||||
require.NoError(t, err)
|
||||
assert.False(t, bytes.Equal(hash1, hash4))
|
||||
assert.False(t, bytes.Equal(hash2, hash4))
|
||||
assert.False(t, bytes.Equal(hash3, hash4))
|
||||
assert.True(t, bytes.Equal([]byte{0, 0, 0, 0, 0, 0, 0, 0}, hash4))
|
||||
}
|
||||
Reference in new issue
Block a user