MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestNodeSetPrivValTCP

Function TestNodeSetPrivValTCP

node/node_test.go:137–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestNodeSetPrivValTCP(t *testing.T) {
138 addr := "tcp://" + testFreeAddr(t)
139
140 config := cfg.ResetTestRoot("node_priv_val_tcp_test")
141 defer os.RemoveAll(config.RootDir)
142 config.BaseConfig.PrivValidatorListenAddr = addr
143
144 dialer := privval.DialTCPFn(addr, 100*time.Millisecond, ed25519.GenPrivKey())
145 dialerEndpoint := privval.NewSignerDialerEndpoint(
146 log.TestingLogger(),
147 dialer,
148 )
149 privval.SignerDialerEndpointTimeoutReadWrite(100 * time.Millisecond)(dialerEndpoint)
150
151 signerServer := privval.NewSignerServer(
152 dialerEndpoint,
153 config.ChainID(),
154 types.NewMockPV(),
155 )
156
157 go func() {
158 err := signerServer.Start()
159 if err != nil {
160 panic(err)
161 }
162 }()
163 defer signerServer.Stop() //nolint:errcheck // ignore for tests
164
165 n, err := DefaultNewNode(config, log.TestingLogger())
166 require.NoError(t, err)
167 assert.IsType(t, &privval.RetrySignerClient{}, n.PrivValidator())
168}
169
170// address without a protocol must result in error
171func TestPrivValidatorListenAddrNoProtocol(t *testing.T) {

Callers

nothing calls this directly

Calls 13

DialTCPFnFunction · 0.92
GenPrivKeyFunction · 0.92
NewSignerDialerEndpointFunction · 0.92
TestingLoggerFunction · 0.92
NewSignerServerFunction · 0.92
NewMockPVFunction · 0.92
testFreeAddrFunction · 0.85
DefaultNewNodeFunction · 0.70
ChainIDMethod · 0.65
StartMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected