Skip to content

Commit

Permalink
tests: address bridge unexported return issue
Browse files Browse the repository at this point in the history
  • Loading branch information
manthanguptaa committed Dec 24, 2024
1 parent 854bdd6 commit 2b8b165
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions tests/framework/integration/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ type Dialer interface {
Dial() (net.Conn, error)
}

// Bridge interface exposing methods of the bridge
type Bridge interface {
Close()
DropConnections()
PauseConnections()
UnpauseConnections()
Blackhole()
Unblackhole()
}

// bridge proxies connections between listener and dialer, making it possible
// to disconnect grpc network connections without closing the logical grpc connection.
type bridge struct {
Expand Down
6 changes: 3 additions & 3 deletions tests/framework/integration/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ type Member struct {
GRPCServerOpts []grpc.ServerOption
GRPCServer *grpc.Server
GRPCURL string
GRPCBridge *bridge
GRPCBridge Bridge

// ServerClient is a clientv3 that directly calls the etcdserver.
ServerClient *clientv3.Client
Expand Down Expand Up @@ -819,7 +819,7 @@ func (m *Member) clientScheme() string {
return ""
}

func (m *Member) addBridge() (*bridge, error) {
func (m *Member) addBridge() (Bridge, error) {
network, host, port := m.grpcAddr()
grpcAddr := net.JoinHostPort(host, m.Port)
bridgePort := fmt.Sprintf("%s%s", port, "0")
Expand All @@ -840,7 +840,7 @@ func (m *Member) addBridge() (*bridge, error) {
return m.GRPCBridge, nil
}

func (m *Member) Bridge() *bridge {
func (m *Member) Bridge() Bridge {
if !m.UseBridge {
m.Logger.Panic("Bridge not available. Please configure using bridge before creating Cluster.")
}
Expand Down

0 comments on commit 2b8b165

Please sign in to comment.