This reverts commit 6d3f9d5154.
This commit is contained in:
@@ -24,10 +24,6 @@ var (
|
||||
quickCfg = &quick.Config{}
|
||||
)
|
||||
|
||||
const (
|
||||
fileSize = 1 << 40
|
||||
)
|
||||
|
||||
func TestPing(t *testing.T) {
|
||||
ar, aw := io.Pipe()
|
||||
br, bw := io.Pipe()
|
||||
@@ -247,6 +243,12 @@ func TestMarshalledIndexMessageSize(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
const (
|
||||
maxMessageSize = MaxMessageLen
|
||||
fileSize = 1 << 40
|
||||
blockSize = BlockSize
|
||||
)
|
||||
|
||||
f := FileInfo{
|
||||
Name: "a normal length file name withoout any weird stuff.txt",
|
||||
Type: FileInfoTypeFile,
|
||||
@@ -254,12 +256,12 @@ func TestMarshalledIndexMessageSize(t *testing.T) {
|
||||
Permissions: 0666,
|
||||
ModifiedS: time.Now().Unix(),
|
||||
Version: Vector{Counters: []Counter{{ID: 1 << 60, Value: 1}, {ID: 2 << 60, Value: 1}}},
|
||||
Blocks: make([]BlockInfo, fileSize/BlockSize),
|
||||
Blocks: make([]BlockInfo, fileSize/blockSize),
|
||||
}
|
||||
|
||||
for i := 0; i < fileSize/BlockSize; i++ {
|
||||
f.Blocks[i].Offset = int64(i) * BlockSize
|
||||
f.Blocks[i].Size = BlockSize
|
||||
for i := 0; i < fileSize/blockSize; i++ {
|
||||
f.Blocks[i].Offset = int64(i) * blockSize
|
||||
f.Blocks[i].Size = blockSize
|
||||
f.Blocks[i].Hash = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 30, 1, 2}
|
||||
}
|
||||
|
||||
@@ -269,8 +271,8 @@ func TestMarshalledIndexMessageSize(t *testing.T) {
|
||||
}
|
||||
|
||||
msgSize := idx.ProtoSize()
|
||||
if msgSize > MaxMessageLen {
|
||||
t.Errorf("Message size %d bytes is larger than max %d", msgSize, MaxMessageLen)
|
||||
if msgSize > maxMessageSize {
|
||||
t.Errorf("Message size %d bytes is larger than max %d", msgSize, maxMessageSize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,31 +400,3 @@ func TestCheckConsistency(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyFileInfo(t *testing.T) {
|
||||
f := FileInfo{
|
||||
Name: "a normal length file name withoout any weird stuff.txt",
|
||||
Type: FileInfoTypeFile,
|
||||
Size: fileSize,
|
||||
Permissions: 0666,
|
||||
ModifiedS: time.Now().Unix(),
|
||||
Version: Vector{Counters: []Counter{{ID: 1 << 60, Value: 1}, {ID: 2 << 60, Value: 1}}},
|
||||
Blocks: make([]BlockInfo, fileSize/BlockSize),
|
||||
}
|
||||
|
||||
del := f.DeletedCopy(LocalDeviceID.Short())
|
||||
if f.Deleted {
|
||||
t.Errorf("Source file info was deleted on copy")
|
||||
}
|
||||
if !del.Deleted {
|
||||
t.Errorf("Returned file info was not deleted on copy")
|
||||
}
|
||||
|
||||
inv := f.InvalidatedCopy(LocalDeviceID.Short())
|
||||
if f.Invalid {
|
||||
t.Errorf("Source file info was invalid on copy")
|
||||
}
|
||||
if !inv.Invalid {
|
||||
t.Errorf("Returned file info was not invalid on copy")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user