MCPcopy Create free account
hub / github.com/tendermint/tendermint / TestNodeSetPrivValTCP

Function TestNodeSetPrivValTCP

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 14

ResetTestRootFunction · 0.92
DialTCPFnFunction · 0.92
GenPrivKeyFunction · 0.92
NewSignerDialerEndpointFunction · 0.92
TestingLoggerFunction · 0.92
NewSignerServerFunction · 0.92
NewMockPVFunction · 0.92
testFreeAddrFunction · 0.85
getTestNodeFunction · 0.85
PrivValidatorMethod · 0.80
ChainIDMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…