goqueue_test.go
634 字节
package goqueue
import (
"fmt"
"github.com/linmadan/egglib-go/utils/json"
"github.com/tal-tech/go-queue/kq"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
"strings"
"testing"
"time"
)
func Test_UpChain(t *testing.T) {
pusher := kq.NewPusher(strings.Split(constant.KAFKA_HOST, ","), constant.TOPIC_UP_BLOCK_CHAIN)
err := pusher.Push(json.MarshalToString(map[string]interface{}{
"source": "allied-creation.cooperation",
"primaryId": fmt.Sprintf("%v", time.Now().Unix()),
"issueId": "key12345",
"data": "{}",
}))
if err != nil {
t.Fatal(err)
}
time.Sleep(time.Second * 5)
}