Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: address bridge unexported return issue #19105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.