go-libp2p-core/canonicallog/canonicallog_test.go
Marco Munizaga c231e0a64f Fix log test
2022-06-16 10:20:07 -07:00

20 lines
563 B
Go

package canonicallog
import (
"fmt"
"testing"
"github.com/libp2p/go-libp2p-core/test"
"github.com/multiformats/go-multiaddr"
)
func TestLogs(t *testing.T) {
LogMisbehavingPeer(test.RandPeerIDFatal(t), multiaddr.StringCast("/ip4/1.2.3.4"), "somecomponent", fmt.Errorf("something"), "hi")
LogMisbehavingPeerNetAddr(test.RandPeerIDFatal(t), dummyNetAddr{}, "somecomponent", fmt.Errorf("something"), "hi")
}
type dummyNetAddr struct{}
func (d dummyNetAddr) Network() string { return "tcp" }
func (d dummyNetAddr) String() string { return "127.0.0.1:80" }