Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Feb 5, 2024
1 parent b6f9166 commit f6aa9bc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/integrations/client/global_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package client_test

import (
"context"
"path"
"strconv"
"testing"
Expand All @@ -37,7 +38,8 @@ import (
const globalConfigPath = "/global/config/"

type testReceiver struct {
re *require.Assertions
re *require.Assertions
ctx context.Context
grpc.ServerStream
}

Expand All @@ -49,6 +51,10 @@ func (s testReceiver) Send(m *pdpb.WatchGlobalConfigResponse) error {
return nil
}

func (s testReceiver) Context() context.Context {
return s.ctx
}

type globalConfigTestSuite struct {
suite.Suite
server *server.GrpcServer
Expand Down Expand Up @@ -199,7 +205,9 @@ func (suite *globalConfigTestSuite) TestWatch() {
re.NoError(err)
}
}()
server := testReceiver{re: suite.Require()}
ctx, cancel := context.WithCancel(suite.server.Context())
defer cancel()
server := testReceiver{re: suite.Require(), ctx: ctx}
go suite.server.WatchGlobalConfig(&pdpb.WatchGlobalConfigRequest{
ConfigPath: globalConfigPath,
Revision: 0,
Expand Down

0 comments on commit f6aa9bc

Please sign in to comment.