Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen/service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func init() {

{{ $hasPosArgs := and .Request (or .Request.IsAllRequiredFieldsPrimitive (eq .PascalName "RunNow")) -}}
{{- $hasSinglePosArg := and $hasPosArgs (eq 1 (len .Request.RequiredFields)) -}}
{{- $serviceHasNamedIdMap := and .Service.List .Service.List.NamedIdMap -}}
{{- $serviceHasNamedIdMap := and (and .Service.List .Service.List.NamedIdMap) (not (eq .PascalName "List")) -}}
{{- $hasIdPrompt := and $hasSinglePosArg $serviceHasNamedIdMap -}}
{{- $wait := and .Wait (and (not .IsCrudRead) (not (eq .SnakeName "get_run"))) -}}
{{- $hasRequiredArgs := and (not $hasIdPrompt) $hasPosArgs -}}
Expand Down
23 changes: 8 additions & 15 deletions cmd/workspace/schemas/schemas.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 8 additions & 15 deletions cmd/workspace/workspace/workspace.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"

_ "github.com/databricks/cli/cmd/workspace"
)

var clusterId string
Expand All @@ -24,7 +22,6 @@ func TestAccClustersList(t *testing.T) {

idRegExp := regexp.MustCompile(`[0-9]{4}\-[0-9]{6}-[a-z0-9]{8}`)
clusterId = idRegExp.FindString(outStr)
fmt.Println(clusterId)
assert.NotEmpty(t, clusterId)
}

Expand Down
2 changes: 2 additions & 0 deletions internal/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"github.com/databricks/cli/cmd/root"
_ "github.com/databricks/cli/cmd/version"
"github.com/stretchr/testify/require"

_ "github.com/databricks/cli/cmd/workspace"
)

const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Expand Down
2 changes: 0 additions & 2 deletions internal/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"

_ "github.com/databricks/cli/cmd/workspace"
)

func TestSecretsCreateScopeErrWhenNoArguments(t *testing.T) {
Expand Down
24 changes: 24 additions & 0 deletions internal/workspace_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package internal

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestAccWorkspaceList(t *testing.T) {
t.Log(GetEnvOrSkipTest(t, "CLOUD_ENV"))

stdout, stderr := RequireSuccessfulRun(t, "workspace", "list", "/")
outStr := stdout.String()
assert.Contains(t, outStr, "ID")
assert.Contains(t, outStr, "Type")
assert.Contains(t, outStr, "Language")
assert.Contains(t, outStr, "Path")
assert.Equal(t, "", stderr.String())
}

func TestWorkpaceListErrorWhenNoArguments(t *testing.T) {
_, _, err := RequireErrorRun(t, "workspace", "list")
assert.Equal(t, "accepts 1 arg(s), received 0", err.Error())
}