seaweedfs/weed/storage/super_block/super_block_test.go

26 lines
483 B
Go
Raw Normal View History

2019-12-24 04:48:20 +08:00
package super_block
2014-09-01 14:25:54 +08:00
import (
"testing"
2019-04-19 12:43:36 +08:00
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
2014-09-01 14:25:54 +08:00
)
func TestSuperBlockReadWrite(t *testing.T) {
rp, _ := NewReplicaPlacementFromByte(byte(001))
2019-04-19 12:43:36 +08:00
ttl, _ := needle.ReadTTL("15d")
2014-09-01 14:25:54 +08:00
s := &SuperBlock{
2019-12-24 04:48:20 +08:00
Version: needle.CurrentVersion,
2014-09-01 14:25:54 +08:00
ReplicaPlacement: rp,
Ttl: ttl,
2014-09-01 14:25:54 +08:00
}
bytes := s.Bytes()
2019-04-19 12:43:36 +08:00
if !(bytes[2] == 15 && bytes[3] == needle.Day) {
println("byte[2]:", bytes[2], "byte[3]:", bytes[3])
2014-09-01 14:25:54 +08:00
t.Fail()
}
}