Merge pull request #127 from unistack-org/cover

add more cover stuff
This commit is contained in:
Василий Толстов 2022-05-03 00:26:13 +03:00 committed by GitHub
commit 289aadb28e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 101 additions and 106 deletions

View File

@ -9,7 +9,7 @@ import (
)
// DefaultBroker default memory broker
var DefaultBroker Broker = NewBroker()
var DefaultBroker = NewBroker()
var (
// ErrNotConnected returns when broker used but not connected yet

View File

@ -34,7 +34,6 @@ func TestSetOption(t *testing.T) {
}
}
func TestSetSaveOption(t *testing.T) {
type key struct{}
o := SetSaveOption(key{}, "test")
@ -46,8 +45,6 @@ func TestSetSaveOption(t *testing.T) {
}
}
func TestSetLoadOption(t *testing.T) {
type key struct{}
o := SetLoadOption(key{}, "test")
@ -59,8 +56,6 @@ func TestSetLoadOption(t *testing.T) {
}
}
func TestSetWatchOption(t *testing.T) {
type key struct{}
o := SetWatchOption(key{}, "test")

View File

@ -97,7 +97,6 @@ func TestErrors(t *testing.T) {
}
}
func TestCodeIn(t *testing.T) {
err := InternalServerError("id", "%s", "msg")

View File

@ -41,7 +41,6 @@ func TestFromOutgoingContext(t *testing.T) {
}
}
func TestSetIncomingContext(t *testing.T) {
md := New(1)
md.Set("key", "val")
@ -72,7 +71,6 @@ func TestSetOutgoingContext(t *testing.T) {
}
}
func TestNewIncomingContext(t *testing.T) {
md := New(1)
md.Set("key", "val")
@ -95,7 +93,6 @@ func TestNewOutgoingContext(t *testing.T) {
}
}
func TestAppendIncomingContext(t *testing.T) {
md := New(1)
md.Set("key1", "val1")

View File

@ -33,4 +33,3 @@ func TestSetOption(t *testing.T) {
t.Fatal("SetOption not works")
}
}

View File

@ -33,4 +33,3 @@ func TestSetOption(t *testing.T) {
t.Fatal("SetOption not works")
}
}

View File

@ -33,4 +33,3 @@ func TestSetOption(t *testing.T) {
t.Fatal("SetOption not works")
}
}

View File

@ -8,9 +8,9 @@ import (
"go.unistack.org/micro/v3/broker"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/server"
"go.unistack.org/micro/v3/logger"
)
type TestHandler struct {

View File

@ -58,6 +58,8 @@ type Service interface {
Run() error
// Start the service
Start() error
// Stop the service
Stop() error
// The service implementation
String() string
}

View File

@ -1,8 +1,8 @@
package micro
import (
"reflect"
"context"
"reflect"
"testing"
"go.unistack.org/micro/v3/auth"
@ -101,7 +101,6 @@ func TestRegisterSubscriber(t *testing.T) {
}
}
func TestNewService(t *testing.T) {
type args struct {
opts []Option
@ -128,7 +127,6 @@ func TestNewService(t *testing.T) {
}
}
func Test_service_Name(t *testing.T) {
type fields struct {
opts Options
@ -158,7 +156,6 @@ func Test_service_Name(t *testing.T) {
}
}
func Test_service_Init(t *testing.T) {
type fields struct {
opts Options
@ -195,7 +192,6 @@ opts: []Option{},
}
}
func Test_service_Options(t *testing.T) {
opts := Options{Name: "test"}
type fields struct {
@ -226,7 +222,6 @@ opts: opts,
}
}
func Test_service_Broker(t *testing.T) {
b := broker.NewBroker()
type fields struct {
@ -264,6 +259,24 @@ func Test_service_Broker(t *testing.T) {
}
}
/*
func TestServiceBroker(t *testing.T) {
b := broker.NewBroker(broker.Name("test"))
srv := server.NewServer()
svc := NewService(Server(srv),Broker(b))
if err := svc.Init(); err != nil {
t.Fatalf("failed to init service")
}
if brk := svc.Server().Options().Broker; brk.Name() != "test" {
t.Fatalf("server broker not set: %v", svc.Server().Options().Broker)
}
}
*/
func Test_service_Tracer(t *testing.T) {
tr := tracer.NewTracer()
@ -339,7 +352,6 @@ func Test_service_Config(t *testing.T) {
}
}
func Test_service_Client(t *testing.T) {
c := client.NewClient()
type fields struct {
@ -377,7 +389,6 @@ func Test_service_Client(t *testing.T) {
}
}
func Test_service_Server(t *testing.T) {
s := server.NewServer()
type fields struct {
@ -415,7 +426,6 @@ func Test_service_Server(t *testing.T) {
}
}
func Test_service_Store(t *testing.T) {
s := store.NewStore()
type fields struct {
@ -453,7 +463,6 @@ func Test_service_Store(t *testing.T) {
}
}
func Test_service_Register(t *testing.T) {
r := register.NewRegister()
type fields struct {
@ -528,7 +537,6 @@ func Test_service_Logger(t *testing.T) {
}
}
func Test_service_Auth(t *testing.T) {
a := auth.NewAuth()
type fields struct {
@ -640,7 +648,6 @@ func Test_service_Meter(t *testing.T) {
}
}
func Test_service_String(t *testing.T) {
type fields struct {
opts Options

View File

@ -33,4 +33,3 @@ func TestSetOption(t *testing.T) {
t.Fatal("SetOption not works")
}
}

View File

@ -22,4 +22,3 @@ func TestNewContext(t *testing.T) {
t.Fatal("NewContext not works")
}
}