mirror of https://github.com/minio/minio.git
576 lines
11 KiB
Go
576 lines
11 KiB
Go
|
package cmd
|
||
|
|
||
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/tinylib/msgp/msgp"
|
||
|
)
|
||
|
|
||
|
func TestMarshalUnmarshalrebalanceInfo(t *testing.T) {
|
||
|
v := rebalanceInfo{}
|
||
|
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 BenchmarkMarshalMsgrebalanceInfo(b *testing.B) {
|
||
|
v := rebalanceInfo{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgrebalanceInfo(b *testing.B) {
|
||
|
v := rebalanceInfo{}
|
||
|
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 BenchmarkUnmarshalrebalanceInfo(b *testing.B) {
|
||
|
v := rebalanceInfo{}
|
||
|
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 TestEncodeDecoderebalanceInfo(t *testing.T) {
|
||
|
v := rebalanceInfo{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecoderebalanceInfo Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := rebalanceInfo{}
|
||
|
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 BenchmarkEncoderebalanceInfo(b *testing.B) {
|
||
|
v := rebalanceInfo{}
|
||
|
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 BenchmarkDecoderebalanceInfo(b *testing.B) {
|
||
|
v := rebalanceInfo{}
|
||
|
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 TestMarshalUnmarshalrebalanceMeta(t *testing.T) {
|
||
|
v := rebalanceMeta{}
|
||
|
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 BenchmarkMarshalMsgrebalanceMeta(b *testing.B) {
|
||
|
v := rebalanceMeta{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgrebalanceMeta(b *testing.B) {
|
||
|
v := rebalanceMeta{}
|
||
|
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 BenchmarkUnmarshalrebalanceMeta(b *testing.B) {
|
||
|
v := rebalanceMeta{}
|
||
|
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 TestEncodeDecoderebalanceMeta(t *testing.T) {
|
||
|
v := rebalanceMeta{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecoderebalanceMeta Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := rebalanceMeta{}
|
||
|
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 BenchmarkEncoderebalanceMeta(b *testing.B) {
|
||
|
v := rebalanceMeta{}
|
||
|
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 BenchmarkDecoderebalanceMeta(b *testing.B) {
|
||
|
v := rebalanceMeta{}
|
||
|
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 TestMarshalUnmarshalrebalanceMetrics(t *testing.T) {
|
||
|
v := rebalanceMetrics{}
|
||
|
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 BenchmarkMarshalMsgrebalanceMetrics(b *testing.B) {
|
||
|
v := rebalanceMetrics{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgrebalanceMetrics(b *testing.B) {
|
||
|
v := rebalanceMetrics{}
|
||
|
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 BenchmarkUnmarshalrebalanceMetrics(b *testing.B) {
|
||
|
v := rebalanceMetrics{}
|
||
|
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 TestEncodeDecoderebalanceMetrics(t *testing.T) {
|
||
|
v := rebalanceMetrics{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecoderebalanceMetrics Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := rebalanceMetrics{}
|
||
|
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 BenchmarkEncoderebalanceMetrics(b *testing.B) {
|
||
|
v := rebalanceMetrics{}
|
||
|
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 BenchmarkDecoderebalanceMetrics(b *testing.B) {
|
||
|
v := rebalanceMetrics{}
|
||
|
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 TestMarshalUnmarshalrebalanceStats(t *testing.T) {
|
||
|
v := rebalanceStats{}
|
||
|
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 BenchmarkMarshalMsgrebalanceStats(b *testing.B) {
|
||
|
v := rebalanceStats{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgrebalanceStats(b *testing.B) {
|
||
|
v := rebalanceStats{}
|
||
|
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 BenchmarkUnmarshalrebalanceStats(b *testing.B) {
|
||
|
v := rebalanceStats{}
|
||
|
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 TestEncodeDecoderebalanceStats(t *testing.T) {
|
||
|
v := rebalanceStats{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecoderebalanceStats Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := rebalanceStats{}
|
||
|
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 BenchmarkEncoderebalanceStats(b *testing.B) {
|
||
|
v := rebalanceStats{}
|
||
|
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 BenchmarkDecoderebalanceStats(b *testing.B) {
|
||
|
v := rebalanceStats{}
|
||
|
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 TestMarshalUnmarshalrstats(t *testing.T) {
|
||
|
v := rstats{}
|
||
|
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 BenchmarkMarshalMsgrstats(b *testing.B) {
|
||
|
v := rstats{}
|
||
|
b.ReportAllocs()
|
||
|
b.ResetTimer()
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
v.MarshalMsg(nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkAppendMsgrstats(b *testing.B) {
|
||
|
v := rstats{}
|
||
|
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 BenchmarkUnmarshalrstats(b *testing.B) {
|
||
|
v := rstats{}
|
||
|
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 TestEncodeDecoderstats(t *testing.T) {
|
||
|
v := rstats{}
|
||
|
var buf bytes.Buffer
|
||
|
msgp.Encode(&buf, &v)
|
||
|
|
||
|
m := v.Msgsize()
|
||
|
if buf.Len() > m {
|
||
|
t.Log("WARNING: TestEncodeDecoderstats Msgsize() is inaccurate")
|
||
|
}
|
||
|
|
||
|
vn := rstats{}
|
||
|
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 BenchmarkEncoderstats(b *testing.B) {
|
||
|
v := rstats{}
|
||
|
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 BenchmarkDecoderstats(b *testing.B) {
|
||
|
v := rstats{}
|
||
|
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)
|
||
|
}
|
||
|
}
|
||
|
}
|