git-hulk commented on code in PR #346:
URL:
https://github.com/apache/kvrocks-controller/pull/346#discussion_r2386751257
##########
store/slot_test.go:
##########
@@ -94,17 +94,15 @@ func TestMigratingSlot_MarshalUnmarshalJSON(t *testing.T) {
migratingSlot = MigratingSlot{SlotRange: SlotRange{Start: 0, Stop: 0},
IsMigrating: false}
migratingSlotBytes, err = json.Marshal(&migratingSlot)
require.NoError(t, err)
- err = json.Unmarshal(migratingSlotBytes, &migratingSlot)
- require.NoError(t, err)
- assert.Equal(t, MigratingSlot{SlotRange{Start: 0, Stop: 0}, false},
migratingSlot)
+ // null []byte equal
+ assert.Equal(t, []byte{0x6e, 0x75, 0x6c, 0x6c}, migratingSlotBytes)
Review Comment:
```suggestion
assert.Equal(t, "null", string(migratingSlotBytes))
```
##########
store/slot_test.go:
##########
@@ -94,17 +94,15 @@ func TestMigratingSlot_MarshalUnmarshalJSON(t *testing.T) {
migratingSlot = MigratingSlot{SlotRange: SlotRange{Start: 0, Stop: 0},
IsMigrating: false}
migratingSlotBytes, err = json.Marshal(&migratingSlot)
require.NoError(t, err)
- err = json.Unmarshal(migratingSlotBytes, &migratingSlot)
- require.NoError(t, err)
- assert.Equal(t, MigratingSlot{SlotRange{Start: 0, Stop: 0}, false},
migratingSlot)
+ // null []byte equal
+ assert.Equal(t, []byte{0x6e, 0x75, 0x6c, 0x6c}, migratingSlotBytes)
// same test as earlier, but checks that it resets the start and stop
migratingSlot = MigratingSlot{SlotRange: SlotRange{Start: 5, Stop: 5},
IsMigrating: false}
migratingSlotBytes, err = json.Marshal(&migratingSlot)
require.NoError(t, err)
- err = json.Unmarshal(migratingSlotBytes, &migratingSlot)
- require.NoError(t, err)
- assert.Equal(t, MigratingSlot{SlotRange{Start: 0, Stop: 0}, false},
migratingSlot, "expects start and stop to reset to 0")
+ // null []byte equal
+ assert.Equal(t, []byte{0x6e, 0x75, 0x6c, 0x6c}, migratingSlotBytes)
Review Comment:
```suggestion
assert.Equal(t, "null", string(migratingSlotBytes))
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]