Fixed storage-credentials list command in text output (#1094)

## Changes
Fixes #1029 
Closes #910 

## Tests
Added regression test
This commit is contained in:
Andrew Nester 2024-01-02 08:24:51 +01:00 committed by GitHub
parent 9a1f078bd9
commit 3e6e04831f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -8,7 +8,7 @@ import (
func listOverride(listCmd *cobra.Command) {
listCmd.Annotations["template"] = cmdio.Heredoc(`
{{header "ID"}} {{header "Name"}} {{header "Credentials"}}
{{range .}}{{.Id|green}} {{.Name|cyan}} {{if .AwsIamRole}}{{.AwsIamRole.RoleArn}}{{end}}{{if .AzureServicePrincipal}}{{.AzureServicePrincipal.ApplicationId}}{{end}}{{if .GcpServiceAccountKey}}{{.Email}}{{end}}
{{range .}}{{.Id|green}} {{.Name|cyan}} {{if .AwsIamRole}}{{.AwsIamRole.RoleArn}}{{end}}{{if .AzureServicePrincipal}}{{.AzureServicePrincipal.ApplicationId}}{{end}}{{if .DatabricksGcpServiceAccount}}{{.DatabricksGcpServiceAccount.Email}}{{end}}
{{end}}`)
}

View File

@ -0,0 +1,15 @@
package internal
import (
"testing"
"github.com/databricks/cli/internal/acc"
"github.com/stretchr/testify/assert"
)
func TestStorageCredentialsListRendersResponse(t *testing.T) {
_, _ = acc.WorkspaceTest(t)
stdout, stderr := RequireSuccessfulRun(t, "storage-credentials", "list")
assert.NotEmpty(t, stdout)
assert.Empty(t, stderr)
}