Files
seaweedFS/weed/sequence/snowflake_sequencer_test.go
promalert 9012069bd7 chore: execute goimports to format the code (#7983)
* chore: execute goimports to format the code

Signed-off-by: promalert <promalert@outlook.com>

* goimports -w .

---------

Signed-off-by: promalert <promalert@outlook.com>
Co-authored-by: Chris Lu <chris.lu@gmail.com>
2026-01-07 13:06:08 -08:00

27 lines
556 B
Go

package sequence
import (
"encoding/hex"
"testing"
"github.com/seaweedfs/seaweedfs/weed/storage/types"
"github.com/stretchr/testify/assert"
)
func TestSequencer(t *testing.T) {
seq, err := NewSnowflakeSequencer("for_test", 1)
assert.Equal(t, nil, err)
last := uint64(0)
bytes := make([]byte, types.NeedleIdSize)
for i := 0; i < 100; i++ {
next := seq.NextFileId(1)
types.NeedleIdToBytes(bytes, types.NeedleId(next))
println(hex.EncodeToString(bytes))
if last == next {
t.Errorf("last %d next %d", last, next)
}
last = next
}
}