mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-24 14:08:13 +08:00
test(2/diag) test print diagnostics
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:

committed by
Juan Batiz-Benet

parent
188bf779db
commit
fb187e49e3
29
core/commands2/diag_test.go
Normal file
29
core/commands2/diag_test.go
Normal file
@ -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())
|
||||
}
|
Reference in New Issue
Block a user