mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-28 22:45:26 +08:00
52 lines
922 B
Go
52 lines
922 B
Go
package mock
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestSegmentMarshal(t *testing.T) {
|
|
t.Skip("to fix test")
|
|
|
|
s := SegmentStats{
|
|
SegementID: uint64(12315),
|
|
MemorySize: uint64(233113),
|
|
MemoryRate: float64(0.13),
|
|
}
|
|
|
|
data, err := SegmentMarshal(s)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
ss, err := SegmentUnMarshal(data)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
if ss.MemoryRate != s.MemoryRate {
|
|
fmt.Println(ss.MemoryRate)
|
|
fmt.Println(s.MemoryRate)
|
|
t.Error("Error when marshal")
|
|
}
|
|
}
|
|
|
|
var Ts = Segment{
|
|
SegmentID: uint64(101111),
|
|
CollectionID: uint64(12010101),
|
|
CollectionName: "collection-test",
|
|
PartitionTag: "default",
|
|
ChannelStart: 1,
|
|
ChannelEnd: 100,
|
|
OpenTimeStamp: uint64(time.Now().Unix()),
|
|
CloseTimeStamp: uint64(time.Now().Add(1 * time.Hour).Unix()),
|
|
}
|
|
|
|
func TestSegment2JSON(t *testing.T) {
|
|
res, err := Segment2JSON(Ts)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
fmt.Println(res)
|
|
}
|