Skip to content

Commit

Permalink
tests: address bridge unexported return issue
Browse files Browse the repository at this point in the history
Signed-off-by: Manthan Gupta <[email protected]>
  • Loading branch information
ahrtr authored and manthanguptaa committed Dec 24, 2024
2 parents 801dfc3 + 99be181 commit 0f6a30f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 5 additions & 1 deletion tests/common/member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ func TestMemberAdd(t *testing.T) {
for _, quorumTc := range quorumTcs {
for _, clusterTc := range clusterTestCases() {
t.Run(learnerTc.name+"/"+quorumTc.name+"/"+clusterTc.name, func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctxTimeout := 10 * time.Second
if quorumTc.waitForQuorum {
ctxTimeout += etcdserver.HealthInterval
}
ctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)
defer cancel()
c := clusterTc.config
c.StrictReconfigCheck = quorumTc.strictReconfigCheck
Expand Down
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 0f6a30f

Please sign in to comment.