aboutsummaryrefslogtreecommitdiff
path: root/go/operation/system_message_test.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2016-06-02 18:09:14 -0700
committerChris Lu <chris.lu@gmail.com>2016-06-02 18:09:14 -0700
commit5ce6bbf07672bf3f3c8d26cd2ce0e3e853a47c44 (patch)
tree2e4dd2ad0a618ab2b7cdebcdb9c503526c31e2e8 /go/operation/system_message_test.go
parentcaeffa3998adc060fa66c4cd77af971ff2d26c57 (diff)
downloadseaweedfs-5ce6bbf07672bf3f3c8d26cd2ce0e3e853a47c44.tar.xz
seaweedfs-5ce6bbf07672bf3f3c8d26cd2ce0e3e853a47c44.zip
directory structure change to work with glide
glide has its own requirements. My previous workaround caused me some code checkin errors. Need to fix this.
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)
- }
-}