From 247e86fc26b35af5ca8a939b1a759b9dec512400 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 28 Dec 2023 16:58:23 +0100 Subject: [PATCH] Fixed storage-credentials list command in text output --- cmd/workspace/storage-credentials/overrides.go | 2 +- internal/storage_credentials_test.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 internal/storage_credentials_test.go diff --git a/cmd/workspace/storage-credentials/overrides.go b/cmd/workspace/storage-credentials/overrides.go index 37c18ca6cea..affcdfec632 100644 --- a/cmd/workspace/storage-credentials/overrides.go +++ b/cmd/workspace/storage-credentials/overrides.go @@ -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}}`) } diff --git a/internal/storage_credentials_test.go b/internal/storage_credentials_test.go new file mode 100644 index 00000000000..250ad3399cb --- /dev/null +++ b/internal/storage_credentials_test.go @@ -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) +}