This commit is contained in:
Jeffrey Picard 2022-10-24 11:45:46 +00:00
parent 89017483ac
commit 8cc5885339
5 changed files with 25 additions and 15 deletions

View file

@ -49,7 +49,7 @@ func removeFile(fileName string) {
func TestAddPeer(t *testing.T) { func TestAddPeer(t *testing.T) {
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
tests := []struct { tests := []struct {
name string name string
@ -108,7 +108,7 @@ func TestAddPeer(t *testing.T) {
func TestPeerWriter(t *testing.T) { func TestPeerWriter(t *testing.T) {
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
args.DisableWritePeers = false args.DisableWritePeers = false
tests := []struct { tests := []struct {
@ -165,8 +165,8 @@ func TestPeerWriter(t *testing.T) {
func TestAddPeerEndpoint(t *testing.T) { func TestAddPeerEndpoint(t *testing.T) {
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
args2 := server.MakeDefaultTestArgs() args2 := MakeDefaultTestArgs()
args2.Port = "50052" args2.Port = "50052"
tests := []struct { tests := []struct {
@ -237,9 +237,9 @@ func TestAddPeerEndpoint(t *testing.T) {
func TestAddPeerEndpoint2(t *testing.T) { func TestAddPeerEndpoint2(t *testing.T) {
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
args2 := server.MakeDefaultTestArgs() args2 := MakeDefaultTestArgs()
args3 := server.MakeDefaultTestArgs() args3 := MakeDefaultTestArgs()
args2.Port = "50052" args2.Port = "50052"
args3.Port = "50053" args3.Port = "50053"
@ -319,9 +319,9 @@ func TestAddPeerEndpoint2(t *testing.T) {
func TestAddPeerEndpoint3(t *testing.T) { func TestAddPeerEndpoint3(t *testing.T) {
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
args2 := server.MakeDefaultTestArgs() args2 := MakeDefaultTestArgs()
args3 := server.MakeDefaultTestArgs() args3 := MakeDefaultTestArgs()
args2.Port = "50052" args2.Port = "50052"
args3.Port = "50053" args3.Port = "50053"
@ -409,9 +409,9 @@ func TestAddPeerEndpoint3(t *testing.T) {
func TestUDPServer(t *testing.T) { func TestUDPServer(t *testing.T) {
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
args.DisableStartUDP = false args.DisableStartUDP = false
args2 := server.MakeDefaultTestArgs() args2 := MakeDefaultTestArgs()
args2.Port = "50052" args2.Port = "50052"
args2.DisableStartUDP = false args2.DisableStartUDP = false

View file

@ -47,7 +47,7 @@ func tcpRead(conn net.Conn) ([]byte, error) {
} }
func TestNotifierServer(t *testing.T) { func TestNotifierServer(t *testing.T) {
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
// ctx := context.Background() // ctx := context.Background()
ctx := stop.NewDebug() ctx := stop.NewDebug()
hub := server.MakeHubServer(ctx, args) hub := server.MakeHubServer(ctx, args)

View file

@ -58,7 +58,7 @@ func TestSearch(t *testing.T) {
ctx := context.Background() ctx := context.Background()
stopGroup := stop.NewDebug() stopGroup := stop.NewDebug()
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
hubServer := server.MakeHubServer(stopGroup, args) hubServer := server.MakeHubServer(stopGroup, args)
req := &pb.SearchRequest{ req := &pb.SearchRequest{
Text: "asdf", Text: "asdf",

View file

@ -1,5 +1,11 @@
package server package server
import (
"github.com/lbryio/herald.go/db"
"github.com/lbryio/lbcd/chaincfg"
"github.com/lbryio/lbry.go/v3/extras/stop"
)
func (s *Server) AddPeerExported() func(*Peer, bool, bool) error { func (s *Server) AddPeerExported() func(*Peer, bool, bool) error {
return s.addPeer return s.addPeer
} }
@ -7,3 +13,7 @@ func (s *Server) AddPeerExported() func(*Peer, bool, bool) error {
func (s *Server) GetNumPeersExported() func() int64 { func (s *Server) GetNumPeersExported() func() int64 {
return s.getNumPeers return s.getNumPeers
} }
func NewSessionManagerExported(db *db.ReadOnlyDBColumnFamily, args *Args, grp *stop.Group, chain *chaincfg.Params) *sessionManager {
return newSessionManager(db, args, grp, chain)
}

View file

@ -11,7 +11,7 @@ import (
// TestUDPPing tests UDPPing correctness against prod server. // TestUDPPing tests UDPPing correctness against prod server.
func TestUDPPing(t *testing.T) { func TestUDPPing(t *testing.T) {
args := server.MakeDefaultTestArgs() args := MakeDefaultTestArgs()
args.DisableStartUDP = true args.DisableStartUDP = true
tests := []struct { tests := []struct {