MCPcopy Create free account
hub / github.com/distributedio/titan / TestMonitor

Function TestMonitor

command/server_test.go:35–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestMonitor(t *testing.T) {
36 assert := assert.New(t)
37 cli := &context.ClientContext{
38 Namespace: "$unittest",
39 ID: 1,
40 RemoteAddr: "127.0.0.1",
41 DB: &db.DB{Namespace: "$unittest", ID: 0},
42 }
43 serv := &context.ServerContext{}
44
45 out := bytes.NewBuffer(nil)
46 ctx := &Context{
47 Name: "monitor",
48 Args: nil,
49 In: nil,
50 Out: out,
51 Context: context.New(cli, serv),
52 }
53
54 Monitor(ctx)
55 assert.Equal("+OK\r\n", out.String())
56
57 out.Reset()
58 ctx = &Context{
59 Name: "ping",
60 Args: nil,
61 In: nil,
62 Out: ioutil.Discard,
63 Context: ctx.Context,
64 }
65 feedMonitors(ctx)
66 assert.Contains(out.String(), "[0 127.0.0.1] ping \r\n")
67}
68
69func TestClient_List(t *testing.T) {
70 assert := assert.New(t)

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
MonitorFunction · 0.85
feedMonitorsFunction · 0.85
ResetMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected