mirror of https://github.com/minio/minio.git
1028 lines
20 KiB
Go
1028 lines
20 KiB
Go
package cmd
|
|
|
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/tinylib/msgp/msgp"
|
|
)
|
|
|
|
func TestMarshalUnmarshalBucketReplicationStat(t *testing.T) {
|
|
v := BucketReplicationStat{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgBucketReplicationStat(b *testing.B) {
|
|
v := BucketReplicationStat{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgBucketReplicationStat(b *testing.B) {
|
|
v := BucketReplicationStat{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalBucketReplicationStat(b *testing.B) {
|
|
v := BucketReplicationStat{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeBucketReplicationStat(t *testing.T) {
|
|
v := BucketReplicationStat{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeBucketReplicationStat Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := BucketReplicationStat{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeBucketReplicationStat(b *testing.B) {
|
|
v := BucketReplicationStat{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeBucketReplicationStat(b *testing.B) {
|
|
v := BucketReplicationStat{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalBucketReplicationStats(t *testing.T) {
|
|
v := BucketReplicationStats{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgBucketReplicationStats(b *testing.B) {
|
|
v := BucketReplicationStats{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgBucketReplicationStats(b *testing.B) {
|
|
v := BucketReplicationStats{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalBucketReplicationStats(b *testing.B) {
|
|
v := BucketReplicationStats{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeBucketReplicationStats(t *testing.T) {
|
|
v := BucketReplicationStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeBucketReplicationStats Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := BucketReplicationStats{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeBucketReplicationStats(b *testing.B) {
|
|
v := BucketReplicationStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeBucketReplicationStats(b *testing.B) {
|
|
v := BucketReplicationStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalBucketStats(t *testing.T) {
|
|
v := BucketStats{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgBucketStats(b *testing.B) {
|
|
v := BucketStats{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgBucketStats(b *testing.B) {
|
|
v := BucketStats{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalBucketStats(b *testing.B) {
|
|
v := BucketStats{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeBucketStats(t *testing.T) {
|
|
v := BucketStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeBucketStats Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := BucketStats{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeBucketStats(b *testing.B) {
|
|
v := BucketStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeBucketStats(b *testing.B) {
|
|
v := BucketStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalBucketStatsMap(t *testing.T) {
|
|
v := BucketStatsMap{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgBucketStatsMap(b *testing.B) {
|
|
v := BucketStatsMap{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgBucketStatsMap(b *testing.B) {
|
|
v := BucketStatsMap{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalBucketStatsMap(b *testing.B) {
|
|
v := BucketStatsMap{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeBucketStatsMap(t *testing.T) {
|
|
v := BucketStatsMap{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeBucketStatsMap Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := BucketStatsMap{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeBucketStatsMap(b *testing.B) {
|
|
v := BucketStatsMap{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeBucketStatsMap(b *testing.B) {
|
|
v := BucketStatsMap{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalReplQNodeStats(t *testing.T) {
|
|
v := ReplQNodeStats{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgReplQNodeStats(b *testing.B) {
|
|
v := ReplQNodeStats{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgReplQNodeStats(b *testing.B) {
|
|
v := ReplQNodeStats{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalReplQNodeStats(b *testing.B) {
|
|
v := ReplQNodeStats{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeReplQNodeStats(t *testing.T) {
|
|
v := ReplQNodeStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeReplQNodeStats Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := ReplQNodeStats{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeReplQNodeStats(b *testing.B) {
|
|
v := ReplQNodeStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeReplQNodeStats(b *testing.B) {
|
|
v := ReplQNodeStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalReplicationLastHour(t *testing.T) {
|
|
v := ReplicationLastHour{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgReplicationLastHour(b *testing.B) {
|
|
v := ReplicationLastHour{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgReplicationLastHour(b *testing.B) {
|
|
v := ReplicationLastHour{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalReplicationLastHour(b *testing.B) {
|
|
v := ReplicationLastHour{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeReplicationLastHour(t *testing.T) {
|
|
v := ReplicationLastHour{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeReplicationLastHour Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := ReplicationLastHour{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeReplicationLastHour(b *testing.B) {
|
|
v := ReplicationLastHour{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeReplicationLastHour(b *testing.B) {
|
|
v := ReplicationLastHour{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalReplicationLastMinute(t *testing.T) {
|
|
v := ReplicationLastMinute{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgReplicationLastMinute(b *testing.B) {
|
|
v := ReplicationLastMinute{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgReplicationLastMinute(b *testing.B) {
|
|
v := ReplicationLastMinute{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalReplicationLastMinute(b *testing.B) {
|
|
v := ReplicationLastMinute{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeReplicationLastMinute(t *testing.T) {
|
|
v := ReplicationLastMinute{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeReplicationLastMinute Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := ReplicationLastMinute{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeReplicationLastMinute(b *testing.B) {
|
|
v := ReplicationLastMinute{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeReplicationLastMinute(b *testing.B) {
|
|
v := ReplicationLastMinute{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalReplicationLatency(t *testing.T) {
|
|
v := ReplicationLatency{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgReplicationLatency(b *testing.B) {
|
|
v := ReplicationLatency{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgReplicationLatency(b *testing.B) {
|
|
v := ReplicationLatency{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalReplicationLatency(b *testing.B) {
|
|
v := ReplicationLatency{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeReplicationLatency(t *testing.T) {
|
|
v := ReplicationLatency{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeReplicationLatency Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := ReplicationLatency{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeReplicationLatency(b *testing.B) {
|
|
v := ReplicationLatency{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeReplicationLatency(b *testing.B) {
|
|
v := ReplicationLatency{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMarshalUnmarshalReplicationQueueStats(t *testing.T) {
|
|
v := ReplicationQueueStats{}
|
|
bts, err := v.MarshalMsg(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
left, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
}
|
|
|
|
left, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(left) > 0 {
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMarshalMsgReplicationQueueStats(b *testing.B) {
|
|
v := ReplicationQueueStats{}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.MarshalMsg(nil)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAppendMsgReplicationQueueStats(b *testing.B) {
|
|
v := ReplicationQueueStats{}
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnmarshalReplicationQueueStats(b *testing.B) {
|
|
v := ReplicationQueueStats{}
|
|
bts, _ := v.MarshalMsg(nil)
|
|
b.ReportAllocs()
|
|
b.SetBytes(int64(len(bts)))
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := v.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEncodeDecodeReplicationQueueStats(t *testing.T) {
|
|
v := ReplicationQueueStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
|
|
m := v.Msgsize()
|
|
if buf.Len() > m {
|
|
t.Log("WARNING: TestEncodeDecodeReplicationQueueStats Msgsize() is inaccurate")
|
|
}
|
|
|
|
vn := ReplicationQueueStats{}
|
|
err := msgp.Decode(&buf, &vn)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
buf.Reset()
|
|
msgp.Encode(&buf, &v)
|
|
err = msgp.NewReader(&buf).Skip()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func BenchmarkEncodeReplicationQueueStats(b *testing.B) {
|
|
v := ReplicationQueueStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
v.EncodeMsg(en)
|
|
}
|
|
en.Flush()
|
|
}
|
|
|
|
func BenchmarkDecodeReplicationQueueStats(b *testing.B) {
|
|
v := ReplicationQueueStats{}
|
|
var buf bytes.Buffer
|
|
msgp.Encode(&buf, &v)
|
|
b.SetBytes(int64(buf.Len()))
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
dc := msgp.NewReader(rd)
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
err := v.DecodeMsg(dc)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|