Closed Jinof closed 3 years ago
Versions: go-micro v2.9.1 micro v2.9.3
When i am trying to test publish message, i can not found a way to achieve it, because micro will read command go test .'s flag. Here is the error: 👇🏽
go test .
flag provided but not defined: -test.testlogfile
And my code is below 👇🏽:
var p micro.Publisher func TestSms_Send(t *testing.T) { msg := &sms.Event{ Phone: "phone number", PhoneCode: "1111", } err := p.Publish(context.Background(), msg) if err != nil { t.Fatal(err) } t.Log("Publish success") } func init() { service := micro.NewService() service.Init() p = micro.NewPublisher(pkg.Topic, service.Client()) }
check this :https://github.com/micro/services/tree/master/test/pubsub
So I can not use go test to test pubsub right? But write a single function to test seems to be an easy way to solve it.
go test
pubsub
Versions: go-micro v2.9.1 micro v2.9.3
When i am trying to test publish message, i can not found a way to achieve it, because micro will read command
go test .
's flag. Here is the error: 👇🏽And my code is below 👇🏽: