Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
greedy52 committed Nov 29, 2024
1 parent 77acc45 commit d1e8553
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/types/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ type EnrichedResource struct {
RequiresRequest bool
}

// EnrichedResources is a list of Enriched resources.
// EnrichedResources is a wrapper of []*EnrichedResource.
type EnrichedResources []*EnrichedResource

// ToResourcesWithLabels converts to ResourcesWithLabels.
Expand Down
23 changes: 20 additions & 3 deletions tool/tsh/common/git_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ package common
import (
"bytes"
"fmt"
"github.com/gravitational/teleport/lib/client"
"testing"

"github.com/gravitational/trace"
"github.com/stretchr/testify/require"
"testing"

"github.com/gravitational/teleport/api/profile"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/lib/client"
)

func makeGitServer(t *testing.T, gitHubOrg string) types.Server {
Expand Down Expand Up @@ -99,13 +101,28 @@ func TestGitListCommand(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
var capture bytes.Buffer
cf := &CLIConf{
Proxy: "proxy",
Username: "alice",
OverrideStdout: &capture,
HomePath: t.TempDir(),
}

// Create a empty profile so we don't ping proxy.
clientStore, err := initClientStore(cf, cf.Proxy)
require.NoError(t, err)
profile := &profile.Profile{
SSHProxyAddr: "proxy:3023",
WebProxyAddr: "proxy:3080",
}
err = clientStore.SaveProfile(profile, true)
require.NoError(t, err)

cmd := gitListCommand{
format: test.format,
fetchFn: test.fetchFn,
}
err := cmd.run(cf)

err = cmd.run(cf)
if test.wantError {
require.Error(t, err)
} else {
Expand Down

0 comments on commit d1e8553

Please sign in to comment.