You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
483 B

6 years ago
6 years ago
6 years ago
  1. package super_block
  2. import (
  3. "testing"
  4. "github.com/seaweedfs/seaweedfs/weed/storage/needle"
  5. )
  6. func TestSuperBlockReadWrite(t *testing.T) {
  7. rp, _ := NewReplicaPlacementFromByte(byte(001))
  8. ttl, _ := needle.ReadTTL("15d")
  9. s := &SuperBlock{
  10. Version: needle.CurrentVersion,
  11. ReplicaPlacement: rp,
  12. Ttl: ttl,
  13. }
  14. bytes := s.Bytes()
  15. if !(bytes[2] == 15 && bytes[3] == needle.Day) {
  16. println("byte[2]:", bytes[2], "byte[3]:", bytes[3])
  17. t.Fail()
  18. }
  19. }