Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley committed Jan 16, 2025
1 parent 5424b1e commit 2d24fff
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/command.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/files.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/command/command_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ func (cp *CommandPlugin) Init(ctx context.Context, messagePipe bus.MessagePipeIn
cp.messagePipe = messagePipe
cp.commandService = NewCommandService(ctx, cp.conn.CommandServiceClient(), cp.config, cp.subscribeChannel)

go cp.monitorSubscribeChannel(ctx)

return nil
}

Expand Down Expand Up @@ -113,6 +111,8 @@ func (cp *CommandPlugin) createConnection(ctx context.Context, resource *mpi.Res
Data: createConnectionResponse,
})
}

go cp.monitorSubscribeChannel(ctx)
}

func (cp *CommandPlugin) processDataPlaneHealth(ctx context.Context, msg *bus.Message) {
Expand Down
8 changes: 6 additions & 2 deletions internal/command/command_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ func (*FakeConfigApplySubscribeClient) Send(*mpi.DataPlaneResponse) error {

// nolint: nilnil
func (*FakeConfigApplySubscribeClient) Recv() (*mpi.ManagementPlaneRequest, error) {
protos.CreateManagementPlaneRequest()
nginxInstance := protos.GetNginxOssInstance([]string{})

return &mpi.ManagementPlaneRequest{
MessageMeta: &mpi.MessageMeta{
MessageId: "1",
Expand All @@ -67,7 +68,7 @@ func (*FakeConfigApplySubscribeClient) Recv() (*mpi.ManagementPlaneRequest, erro
ConfigApplyRequest: &mpi.ConfigApplyRequest{
Overview: &mpi.FileOverview{
ConfigVersion: &mpi.ConfigVersion{
InstanceId: "12314",
InstanceId: nginxInstance.GetInstanceMeta().GetInstanceId(),
Version: "4215432",
},
},
Expand Down Expand Up @@ -113,6 +114,9 @@ func TestCommandService_receiveCallback_configApplyRequest(t *testing.T) {
subscribeChannel,
)

nginxInstance := protos.GetNginxOssInstance([]string{})
commandService.instances = append(commandService.instances, nginxInstance)

defer commandService.CancelSubscription(ctx)

var wg sync.WaitGroup
Expand Down

0 comments on commit 2d24fff

Please sign in to comment.