Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley committed Jun 11, 2024
1 parent 7b8fcc5 commit d2da62c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/command/command_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package command
import (
"context"
"testing"
"time"

"github.com/nginx/agent/v3/api/grpc/mpi/v1/v1fakes"
"github.com/nginx/agent/v3/test/protos"
Expand All @@ -32,6 +33,27 @@ func (*FakeSubscribeClient) Recv() (*mpi.ManagementPlaneRequest, error) {
return nil, nil
}

func TestCommandService_NewCommandService(t *testing.T) {
ctx := context.Background()
commandServiceClient := &v1fakes.FakeCommandServiceClient{}

commandService := NewCommandService(
ctx,
commandServiceClient,
types.GetAgentConfig(),
make(chan *mpi.ManagementPlaneRequest),
)

defer commandService.CancelSubscription(ctx)

assert.Eventually(
t,
func() bool { return commandServiceClient.SubscribeCallCount() > 0 },
2*time.Second,
10*time.Millisecond,
)
}

func TestCommandService_UpdateDataPlaneStatus(t *testing.T) {
ctx := context.Background()

Expand Down

0 comments on commit d2da62c

Please sign in to comment.