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

Function TestComplexRPC

crypto/etls/conn_test.go:233–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

231}
232
233func TestComplexRPC(t *testing.T) {
234 l := serverComplex()
235 Convey("get addr", t, func() {
236 addr := l.Addr().String()
237 So(addr, ShouldEqual, serviceComplex)
238 })
239 Convey("server client OK", t, func() {
240 argsComplex := &QueryComplex{
241 DataS: struct{ Strs []string }{Strs: []string{"aaa", "bbbbbbb"}},
242 }
243 ret, err := clientComplex(pass, argsComplex)
244 So(ret.Count, ShouldEqual, len(argsComplex.DataS.Strs))
245 So(ret.Hash.Str, ShouldResemble, qHash(argsComplex))
246 So(err, ShouldBeNil)
247 })
248 Convey("server client pass error", t, func() {
249 argsComplex := &QueryComplex{
250 DataS: struct{ Strs []string }{Strs: []string{"aaa", "bbbbbbb"}},
251 }
252 ret, err := clientComplex(pass+"1", argsComplex)
253 So(ret, ShouldBeNil)
254 So(err, ShouldNotBeNil)
255 })
256
257 Convey("server client pass error", t, func() {
258 argsComplex := &QueryComplex{
259 DataS: struct{ Strs []string }{Strs: []string{"aaa", "bbbbbbb"}},
260 }
261 ret, err := clientComplex(strings.Repeat(pass, 100), argsComplex)
262 So(ret, ShouldBeNil)
263 So(err, ShouldNotBeNil)
264 })
265
266 Convey("server close", t, func() {
267 err := l.Close()
268 So(err, ShouldBeNil)
269 })
270}
271
272func TestCryptoConn_RW(t *testing.T) {
273 cipher := NewCipher([]byte(pass))

Callers

nothing calls this directly

Calls 6

serverComplexFunction · 0.85
clientComplexFunction · 0.85
qHashFunction · 0.85
AddrMethod · 0.80
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected