add discov tests (#448)
This commit is contained in:
@@ -4,10 +4,12 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tal-tech/go-zero/core/discov/internal"
|
||||
"github.com/tal-tech/go-zero/core/lang"
|
||||
"github.com/tal-tech/go-zero/core/logx"
|
||||
"go.etcd.io/etcd/clientv3"
|
||||
)
|
||||
@@ -152,3 +154,16 @@ func TestPublisher_keepAliveAsyncPause(t *testing.T) {
|
||||
pub.Pause()
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestPublisher_Resume(t *testing.T) {
|
||||
publisher := new(Publisher)
|
||||
publisher.resumeChan = make(chan lang.PlaceholderType)
|
||||
go func() {
|
||||
publisher.Resume()
|
||||
}()
|
||||
go func() {
|
||||
time.Sleep(time.Minute)
|
||||
t.Fail()
|
||||
}()
|
||||
<-publisher.resumeChan
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user