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

Function TestNodeSetPrivValIPC

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

Source from the content-addressed store, hash-verified

180}
181
182func TestNodeSetPrivValIPC(t *testing.T) {
183 tmpfile := "/tmp/kms." + tmrand.Str(6) + ".sock"
184 defer os.Remove(tmpfile) // clean up
185
186 config := cfg.ResetTestRoot("node_priv_val_tcp_test")
187 defer os.RemoveAll(config.RootDir)
188 config.BaseConfig.PrivValidatorListenAddr = "unix://" + tmpfile
189
190 dialer := privval.DialUnixFn(tmpfile)
191 dialerEndpoint := privval.NewSignerDialerEndpoint(
192 log.TestingLogger(),
193 dialer,
194 )
195 privval.SignerDialerEndpointTimeoutReadWrite(100 * time.Millisecond)(dialerEndpoint)
196
197 pvsc := privval.NewSignerServer(
198 dialerEndpoint,
199 config.ChainID(),
200 types.NewMockPV(),
201 )
202
203 go func() {
204 err := pvsc.Start()
205 require.NoError(t, err)
206 }()
207 defer pvsc.Stop() //nolint:errcheck // ignore for tests
208
209 n, err := DefaultNewNode(config, log.TestingLogger())
210 require.NoError(t, err)
211 assert.IsType(t, &privval.RetrySignerClient{}, n.PrivValidator())
212}
213
214// testFreeAddr claims a free port so we don't block on listener being ready.
215func testFreeAddr(t *testing.T) string {

Callers

nothing calls this directly

Calls 13

DialUnixFnFunction · 0.92
NewSignerDialerEndpointFunction · 0.92
TestingLoggerFunction · 0.92
NewSignerServerFunction · 0.92
NewMockPVFunction · 0.92
StrMethod · 0.80
DefaultNewNodeFunction · 0.70
RemoveMethod · 0.65
ChainIDMethod · 0.65
StartMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected