forked from yomorun/yomo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zipper_test.go
34 lines (31 loc) · 863 Bytes
/
zipper_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package yomo
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/yomorun/yomo/core"
"github.com/yomorun/yomo/core/router"
"github.com/yomorun/yomo/core/ylog"
"github.com/yomorun/yomo/pkg/config"
)
func TestZipperRun(t *testing.T) {
zipper, err := NewZipper(
"zipper",
map[string]config.Mesh{},
// WithAuth("token", "<CREDENTIAL>"),
WithUpstreamOption(core.ClientOption(WithCredential("token:<CREDENTIAL>"))),
WithZipperLogger(ylog.Default()),
WithRouter(router.Default()),
WithConnector(core.NewConnector(context.TODO())),
WithVersionNegotiateFunc(core.DefaultVersionNegotiateFunc),
WithZipperQuicConfig(core.DefaultQuicConfig),
WithZipperTLSConfig(nil),
)
assert.Nil(t, err)
time.Sleep(time.Second)
assert.NotNil(t, zipper)
err = zipper.Close()
time.Sleep(time.Second)
assert.Nil(t, err)
}