fix for empty body codec test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-11-26 08:57:54 +03:00
parent 7f0c11006c
commit 1371dc1d23
7 changed files with 541 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/google/uuid"
http "github.com/unistack-org/micro-broker-http"
jsoncodec "github.com/unistack-org/micro-codec-json"
rmemory "github.com/unistack-org/micro-registry-memory"
"github.com/unistack-org/micro/v3/broker"
"github.com/unistack-org/micro/v3/registry"
@@ -63,7 +64,7 @@ func sub(be *testing.B, c int) {
be.StopTimer()
m := newTestRegistry()
b := http.NewBroker(broker.Registry(m))
b := http.NewBroker(broker.Codec(jsoncodec.NewCodec()), broker.Registry(m))
topic := uuid.New().String()
if err := b.Init(); err != nil {
@@ -122,7 +123,7 @@ func sub(be *testing.B, c int) {
func pub(be *testing.B, c int) {
be.StopTimer()
m := newTestRegistry()
b := http.NewBroker(broker.Registry(m))
b := http.NewBroker(broker.Codec(jsoncodec.NewCodec()), broker.Registry(m))
topic := uuid.New().String()
if err := b.Init(); err != nil {
@@ -191,7 +192,7 @@ func pub(be *testing.B, c int) {
func TestBroker(t *testing.T) {
m := newTestRegistry()
b := http.NewBroker(broker.Registry(m))
b := http.NewBroker(broker.Codec(jsoncodec.NewCodec()), broker.Registry(m))
if err := b.Init(); err != nil {
t.Fatalf("Unexpected init error: %v", err)
@@ -238,7 +239,7 @@ func TestBroker(t *testing.T) {
func TestConcurrentSubBroker(t *testing.T) {
m := newTestRegistry()
b := http.NewBroker(broker.Registry(m))
b := http.NewBroker(broker.Codec(jsoncodec.NewCodec()), broker.Registry(m))
if err := b.Init(); err != nil {
t.Fatalf("Unexpected init error: %v", err)
@@ -295,7 +296,7 @@ func TestConcurrentSubBroker(t *testing.T) {
func TestConcurrentPubBroker(t *testing.T) {
m := newTestRegistry()
b := http.NewBroker(broker.Registry(m))
b := http.NewBroker(broker.Codec(jsoncodec.NewCodec()), broker.Registry(m))
if err := b.Init(); err != nil {
t.Fatalf("Unexpected init error: %v", err)