add before Init func support
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
23
vault_test.go
Normal file
23
vault_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package vault
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"go.unistack.org/micro/v3/codec"
|
||||
"go.unistack.org/micro/v3/config"
|
||||
)
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
c := NewConfig(
|
||||
config.Context(context.TODO()),
|
||||
config.Codec(codec.NewCodec()),
|
||||
config.BeforeInit(func(ctx context.Context, c config.Config) error {
|
||||
return c.Init(Token("tkn"), config.BeforeInit(nil))
|
||||
}),
|
||||
)
|
||||
|
||||
if err := c.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user