1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| package service
|
| import (
| "basic.com/pubsub/protomsg.git"
| "github.com/satori/go.uuid"
| "io/ioutil"
| "testing"
| "time"
| )
|
| func TestPushImgMsg(t *testing.T) {
| InitService()
| imgData := readImgFile()
| for {
| PushImgMsg(protomsg.Recvmsg{
| Id:uuid.NewV4().String(),
| Addr:"",
| Picdata:imgData,
| })
|
| time.Sleep(5*time.Second)
| }
| }
|
| func readImgFile() []byte{
| filePath := "/home/user/workspace/timg.jpg"
| bytes, _ := ioutil.ReadFile(filePath)
| return bytes
| }
|
|