fix HandshakeIncompatibleVersion test
This commit is contained in:
parent
e97e6b68c6
commit
89afc03218
@ -53,7 +53,9 @@ type secureService struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *secureService) Init(a *app.App) (err error) {
|
func (s *secureService) Init(a *app.App) (err error) {
|
||||||
|
if s.protoVersion == 0 {
|
||||||
s.protoVersion = ProtoVersion
|
s.protoVersion = ProtoVersion
|
||||||
|
}
|
||||||
account := a.MustComponent(commonaccount.CName).(commonaccount.Service)
|
account := a.MustComponent(commonaccount.CName).(commonaccount.Service)
|
||||||
peerKey, err := account.Account().PeerKey.Raw()
|
peerKey, err := account.Account().PeerKey.Raw()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -57,7 +57,7 @@ func TestHandshake(t *testing.T) {
|
|||||||
|
|
||||||
func TestHandshakeIncompatibleVersion(t *testing.T) {
|
func TestHandshakeIncompatibleVersion(t *testing.T) {
|
||||||
nc := testnodeconf.GenNodeConfig(2)
|
nc := testnodeconf.GenNodeConfig(2)
|
||||||
fxS := newFixture(t, nc, nc.GetAccountService(0), 0)
|
fxS := newFixture(t, nc, nc.GetAccountService(0), 1)
|
||||||
defer fxS.Finish(t)
|
defer fxS.Finish(t)
|
||||||
sc, cc := net.Pipe()
|
sc, cc := net.Pipe()
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ func TestHandshakeIncompatibleVersion(t *testing.T) {
|
|||||||
ar.ctx, ar.err = fxS.SecureInbound(ctx, sc)
|
ar.ctx, ar.err = fxS.SecureInbound(ctx, sc)
|
||||||
resCh <- ar
|
resCh <- ar
|
||||||
}()
|
}()
|
||||||
fxC := newFixture(t, nc, nc.GetAccountService(1), 1)
|
fxC := newFixture(t, nc, nc.GetAccountService(1), 2)
|
||||||
defer fxC.Finish(t)
|
defer fxC.Finish(t)
|
||||||
_, err := fxC.SecureOutbound(ctx, cc)
|
_, err := fxC.SecureOutbound(ctx, cc)
|
||||||
require.Equal(t, handshake.ErrIncompatibleVersion, err)
|
require.Equal(t, handshake.ErrIncompatibleVersion, err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user