From 77e9ceb0a238b10fce2b482064a665683f8e73dc Mon Sep 17 00:00:00 2001 From: dhurley Date: Tue, 7 May 2024 13:24:41 +0100 Subject: [PATCH] Fix tests --- .github/workflows/ci.yml | 2 ++ test/performance/metrics_test.go | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47b863f28c..f2029c7e59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,6 +144,8 @@ jobs: version: "bookworm-slim" steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + with: + fetch-depth: 0 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: 'go.mod' diff --git a/test/performance/metrics_test.go b/test/performance/metrics_test.go index 0b491d863b..899a976626 100644 --- a/test/performance/metrics_test.go +++ b/test/performance/metrics_test.go @@ -210,12 +210,34 @@ func (h *handler) handle(server proto.Commander_CommandChannelServer, wg *sync.W }() h.handleCount.Inc() for { - _, err := server.Recv() + commandReceived, err := server.Recv() if err != nil { fmt.Printf("Command Error: %v\n", err) return } h.msgCount.Inc() + + connectRequest := commandReceived.GetAgentConnectRequest() + if connectRequest != nil { + err = server.Send( + &proto.Command{ + Data: &proto.Command_AgentConnectResponse{ + AgentConnectResponse: &proto.AgentConnectResponse{ + AgentConfig: &proto.AgentConfig{ + Details: connectRequest.GetMeta().GetAgentDetails(), + }, + Status: &proto.AgentConnectStatus{ + StatusCode: proto.AgentConnectStatus_CONNECT_OK, + }, + }, + }, + }, + ) + if err != nil { + fmt.Printf("Command Error: %v\n", err) + return + } + } } }