2019-11-18 16:22:08 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2020-05-04 11:37:14 +00:00
|
|
|
func TestCutRestoreMeta(t *testing.T) {
|
|
|
|
items := []func() SeizedMetaHeaderContainer{
|
|
|
|
func() SeizedMetaHeaderContainer {
|
|
|
|
m := new(RequestMetaHeader)
|
|
|
|
m.SetEpoch(1)
|
|
|
|
return m
|
|
|
|
},
|
|
|
|
}
|
2020-04-28 12:39:09 +00:00
|
|
|
|
2020-05-04 11:37:14 +00:00
|
|
|
for _, item := range items {
|
|
|
|
v1 := item()
|
|
|
|
m1 := v1.CutMeta()
|
|
|
|
v1.RestoreMeta(m1)
|
2020-04-28 12:39:09 +00:00
|
|
|
|
2020-05-04 11:37:14 +00:00
|
|
|
require.Equal(t, item(), v1)
|
|
|
|
}
|
2020-04-28 12:39:09 +00:00
|
|
|
}
|