MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestEncryptIncCounterSimpleArgs

Function TestEncryptIncCounterSimpleArgs

rpc/mux/server_test.go:188–220  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

186}
187
188func TestEncryptIncCounterSimpleArgs(t *testing.T) {
189 defer utils.RemoveAll(PubKeyStorePath + "*")
190 log.SetLevel(log.FatalLevel)
191 addr := "127.0.0.1:0"
192 masterKey := []byte("abc")
193 server, err := NewServerWithService(ServiceMap{"Test": NewTestService()})
194 if err != nil {
195 log.Fatal(err)
196 }
197
198 _, _ = route.NewDHTService(PubKeyStorePath, new(consistent.KMSStorage), true)
199 _ = server.InitRPCServer(addr, "../keys/test.key", masterKey)
200 go server.Serve()
201
202 publicKey, err := kms.GetLocalPublicKey()
203 nonce := asymmetric.GetPubKeyNonce(publicKey, 10, 100*time.Millisecond, nil)
204 serverNodeID := proto.NodeID(nonce.Hash.String())
205 _ = kms.SetPublicKey(serverNodeID, nonce.Nonce, publicKey)
206 kms.SetLocalNodeIDNonce(nonce.Hash.CloneBytes(), &nonce.Nonce)
207 _ = route.SetNodeAddrCache(&proto.RawNodeID{Hash: nonce.Hash}, server.Listener.Addr().String())
208
209 client, err := rpc.DialToNodeWithPool(&nilSessionPool{}, serverNodeID, false)
210
211 repSimple := new(int32)
212 err = client.Call("Test.IncCounterSimpleArgs", 10, repSimple)
213 if err != nil {
214 log.Fatal(err)
215 }
216 CheckNum(*repSimple, 10, t)
217
218 _ = client.Close()
219 server.Stop()
220}
221
222func TestETLSBug(t *testing.T) {
223 defer utils.RemoveAll(PubKeyStorePath + "*")

Callers

nothing calls this directly

Calls 15

RemoveAllFunction · 0.92
SetLevelFunction · 0.92
FatalFunction · 0.92
NewDHTServiceFunction · 0.92
GetLocalPublicKeyFunction · 0.92
GetPubKeyNonceFunction · 0.92
NodeIDTypeAlias · 0.92
SetPublicKeyFunction · 0.92
SetLocalNodeIDNonceFunction · 0.92
SetNodeAddrCacheFunction · 0.92
DialToNodeWithPoolFunction · 0.92
InitRPCServerMethod · 0.80

Tested by

no test coverage detected