Skip to content

Commit

Permalink
STAC-21470: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
craffit committed Aug 1, 2024
1 parent 3a2690c commit 5370190
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/agent/agent_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func ListCommand(deps *di.Deps) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "List all registered agents.",
Short: "List all registered agents",
Long: "List all registered agents.",
RunE: deps.CmdRunEWithApi(RunListCommand),
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/agent/agent_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package agent

import (
"testing"
"time"

"github.com/stackvista/stackstate-cli/generated/stackstate_api"
"github.com/stackvista/stackstate-cli/internal/di"
Expand Down Expand Up @@ -44,12 +45,14 @@ func TestAgentList(t *testing.T) {

assert.Len(t, *cli.MockClient.ApiMocks.AgentRegistrationsApi.AllAgentRegistrationsCalls, 1)

nulTime := time.UnixMilli(0).Format("2006-01-02 15:04:05 MST")

expectedTable := []printer.TableData{
{
Header: []string{"Host", "Lease", "Registered", "Last Lease", "CPUS", "Memory", "Platform", "Kernel"},
Data: [][]interface{}{
{"id1", stackstate_api.AGENTLEASE_ACTIVE, "1970-01-01 01:00:00 CET", "1970-01-01 01:00:00 CET", "4", "16MB", "platform", "5.15"},
{"id2", stackstate_api.AGENTLEASE_LIMITED, "1970-01-01 01:00:00 CET", "1970-01-01 01:00:00 CET", "0", "0MB", "", ""},
{"id1", stackstate_api.AGENTLEASE_ACTIVE, nulTime, nulTime, "4", "16MB", "platform", "5.15"},
{"id2", stackstate_api.AGENTLEASE_LIMITED, nulTime, nulTime, "0", "0MB", "", ""},
},
},
}
Expand Down

0 comments on commit 5370190

Please sign in to comment.