fix: normalize admin config checksums
This commit is contained in:
parent
363d217c35
commit
beaf4c9c38
@ -36,7 +36,7 @@ func Run(t *testing.T, factory Factory) {
|
||||
|
||||
func runConfigContract(t *testing.T, store adminstate.Store) {
|
||||
t.Helper()
|
||||
command := configCommand("req-config", "cfg-1", strings.Repeat("a", adminstate.SHA256HexBytes))
|
||||
command := configCommand("req-config", "cfg-1", strings.Repeat("ab", adminstate.SHA256HexBytes/2))
|
||||
result, err := store.CommitConfig(context.Background(), command)
|
||||
if err != nil || !result.Changed || result.Revision != 1 || result.RequestID != command.RequestID {
|
||||
t.Fatalf("CommitConfig(first) = %+v, %v", result, err)
|
||||
@ -58,6 +58,7 @@ func runConfigContract(t *testing.T, store adminstate.Store) {
|
||||
|
||||
command.RequestID = "req-config-replay"
|
||||
command.OccurredAt = command.OccurredAt.Add(time.Second)
|
||||
command.Checksum = strings.ToUpper(command.Checksum)
|
||||
replayed, err := store.CommitConfig(context.Background(), command)
|
||||
if err != nil || replayed.Changed || replayed.Revision != 1 {
|
||||
t.Fatalf("CommitConfig(replay) = %+v, %v", replayed, err)
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"math"
|
||||
"net/netip"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@ -42,6 +43,7 @@ func (store *MemoryStore) CommitConfig(ctx context.Context, command CommitConfig
|
||||
return result, ErrInvalidCommand
|
||||
}
|
||||
command = cloneCommitConfigCommand(command)
|
||||
command.Checksum = strings.ToLower(command.Checksum)
|
||||
|
||||
store.mu.Lock()
|
||||
defer store.mu.Unlock()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user