From fb187e49e3e3075c22c360e3eb8384d51df8af51 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Wed, 12 Nov 2014 22:30:44 -0800 Subject: [PATCH] test(2/diag) test print diagnostics License: MIT Signed-off-by: Brian Tiger Chow --- core/commands2/diag_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 core/commands2/diag_test.go diff --git a/core/commands2/diag_test.go b/core/commands2/diag_test.go new file mode 100644 index 000000000..5e6c383e2 --- /dev/null +++ b/core/commands2/diag_test.go @@ -0,0 +1,29 @@ +package commands + +import ( + "bytes" + "testing" +) + +func TestPrintDiagnostics(t *testing.T) { + output := DiagnosticOutput{ + Peers: []DiagnosticPeer{ + DiagnosticPeer{ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg", + UptimeSeconds: 14, + Connections: []DiagnosticConnection{ + DiagnosticConnection{ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg", + NanosecondsLatency: 1347899, + }, + }, + }, + DiagnosticPeer{ID: "QmUaUZDp6QWJabBYSKfiNmXLAXD8HNKnWZh9Zoz6Zri9Ti", + UptimeSeconds: 14, + }, + }, + } + var buf bytes.Buffer + if err := printDiagnostics(&buf, &output); err != nil { + t.Fatal(err) + } + t.Log(buf.String()) +}