mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 05:07:57 +08:00
fix tests
This commit is contained in:
@@ -39,10 +39,10 @@ func TestProtoMarshalText(t *testing.T) {
|
|||||||
DeleteChunks: true,
|
DeleteChunks: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
text := proto.MarshalTextString(notification)
|
text, _ := proto.Marshal(notification)
|
||||||
|
|
||||||
notification2 := &filer_pb.EventNotification{}
|
notification2 := &filer_pb.EventNotification{}
|
||||||
proto.UnmarshalText(text, notification2)
|
proto.Unmarshal(text, notification2)
|
||||||
|
|
||||||
if notification2.OldEntry.Chunks[0].SourceFileId != notification.OldEntry.Chunks[0].SourceFileId {
|
if notification2.OldEntry.Chunks[0].SourceFileId != notification.OldEntry.Chunks[0].SourceFileId {
|
||||||
t.Fatalf("marshal/unmarshal error: %s", text)
|
t.Fatalf("marshal/unmarshal error: %s", text)
|
||||||
|
@@ -16,15 +16,15 @@ func TestJsonpMarshalUnmarshal(t *testing.T) {
|
|||||||
FileSize: 12,
|
FileSize: 12,
|
||||||
}
|
}
|
||||||
|
|
||||||
m := jsonpb.Marshaler{
|
m := jsonpb.MarshalOptions{
|
||||||
EmitDefaults: true,
|
EmitUnpopulated: true,
|
||||||
Indent: " ",
|
Indent: " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
if text, err := m.MarshalToString(tv); err != nil {
|
if text, err := m.Marshal(tv); err != nil {
|
||||||
fmt.Printf("marshal eror: %v\n", err)
|
fmt.Printf("marshal eror: %v\n", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("marshalled: %s\n", text)
|
fmt.Printf("marshalled: %s\n", string(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
rawJson := `{
|
rawJson := `{
|
||||||
@@ -34,7 +34,7 @@ func TestJsonpMarshalUnmarshal(t *testing.T) {
|
|||||||
}`
|
}`
|
||||||
|
|
||||||
tv1 := &volume_server_pb.RemoteFile{}
|
tv1 := &volume_server_pb.RemoteFile{}
|
||||||
if err := jsonpb.UnmarshalString(rawJson, tv1); err != nil {
|
if err := jsonpb.Unmarshal([]byte(rawJson), tv1); err != nil {
|
||||||
fmt.Printf("unmarshal error: %v\n", err)
|
fmt.Printf("unmarshal error: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,14 +58,14 @@ func TestIdentityListFileFormat(t *testing.T) {
|
|||||||
s3ApiConfiguration.Identities = append(s3ApiConfiguration.Identities, identity2)
|
s3ApiConfiguration.Identities = append(s3ApiConfiguration.Identities, identity2)
|
||||||
s3ApiConfiguration.Identities = append(s3ApiConfiguration.Identities, identity3)
|
s3ApiConfiguration.Identities = append(s3ApiConfiguration.Identities, identity3)
|
||||||
|
|
||||||
m := jsonpb.Marshaler{
|
m := jsonpb.MarshalOptions{
|
||||||
EmitDefaults: true,
|
EmitUnpopulated: true,
|
||||||
Indent: " ",
|
Indent: " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
text, _ := m.MarshalToString(s3ApiConfiguration)
|
text, _ := m.Marshal(s3ApiConfiguration)
|
||||||
|
|
||||||
println(text)
|
println(string(text))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/storage/types"
|
"github.com/seaweedfs/seaweedfs/weed/storage/types"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"google.golang.org/protobuf/proto"
|
//"google.golang.org/protobuf/proto"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
Reference in New Issue
Block a user