|
|
@ -4,10 +4,12 @@ import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/golang/mock/gomock"
|
|
|
|
"github.com/golang/mock/gomock"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/tal-tech/go-zero/core/discov/internal"
|
|
|
|
"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"
|
|
|
|
"github.com/tal-tech/go-zero/core/logx"
|
|
|
|
"go.etcd.io/etcd/clientv3"
|
|
|
|
"go.etcd.io/etcd/clientv3"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -152,3 +154,16 @@ func TestPublisher_keepAliveAsyncPause(t *testing.T) {
|
|
|
|
pub.Pause()
|
|
|
|
pub.Pause()
|
|
|
|
wg.Wait()
|
|
|
|
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
|
|
|
|
|
|
|
|
}
|
|
|
|