aboutsummaryrefslogtreecommitdiff
path: root/go/operation/system_message_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/operation/system_message_test.go')
-rw-r--r--go/operation/system_message_test.go59
1 files changed, 0 insertions, 59 deletions
diff --git a/go/operation/system_message_test.go b/go/operation/system_message_test.go
deleted file mode 100644
index d18ca49a4..000000000
--- a/go/operation/system_message_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package operation
-
-import (
- "encoding/json"
- "log"
- "testing"
-
- "github.com/golang/protobuf/proto"
-)
-
-func TestSerialDeserial(t *testing.T) {
- volumeMessage := &VolumeInformationMessage{
- Id: proto.Uint32(12),
- Size: proto.Uint64(2341234),
- Collection: proto.String("benchmark"),
- FileCount: proto.Uint64(2341234),
- DeleteCount: proto.Uint64(234),
- DeletedByteCount: proto.Uint64(21234),
- ReadOnly: proto.Bool(false),
- ReplicaPlacement: proto.Uint32(210),
- Version: proto.Uint32(2),
- }
- var volumeMessages []*VolumeInformationMessage
- volumeMessages = append(volumeMessages, volumeMessage)
-
- joinMessage := &JoinMessage{
- IsInit: proto.Bool(true),
- Ip: proto.String("127.0.3.12"),
- Port: proto.Uint32(34546),
- PublicUrl: proto.String("localhost:2342"),
- MaxVolumeCount: proto.Uint32(210),
- MaxFileKey: proto.Uint64(324234423),
- DataCenter: proto.String("dc1"),
- Rack: proto.String("rack2"),
- Volumes: volumeMessages,
- }
-
- data, err := proto.Marshal(joinMessage)
- if err != nil {
- log.Fatal("marshaling error: ", err)
- }
- newMessage := &JoinMessage{}
- err = proto.Unmarshal(data, newMessage)
- if err != nil {
- log.Fatal("unmarshaling error: ", err)
- }
- log.Println("The pb data size is", len(data))
-
- jsonData, jsonError := json.Marshal(joinMessage)
- if jsonError != nil {
- log.Fatal("json marshaling error: ", jsonError)
- }
- log.Println("The json data size is", len(jsonData), string(jsonData))
-
- // Now test and newTest contain the same data.
- if *joinMessage.PublicUrl != *newMessage.PublicUrl {
- log.Fatalf("data mismatch %q != %q", *joinMessage.PublicUrl, *newMessage.PublicUrl)
- }
-}