From 3e6e04831f20ca374600993dcbb2afc9f77e344c Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Tue, 2 Jan 2024 08:24:51 +0100 Subject: [PATCH] Fixed storage-credentials list command in text output (#1094) ## Changes Fixes #1029 Closes #910 ## Tests Added regression test --- 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 37c18ca6..affcdfec 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 00000000..250ad339 --- /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) +}