Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate acceptance tests for help output for all CLI commands #2260

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions .codegen.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"formatter": "go run golang.org/x/tools/cmd/goimports@latest -w $FILENAMES && go fmt ./...",
"formatter": "go run golang.org/x/tools/cmd/goimports@latest -w cmd && go fmt ./...",
"services": {
".codegen/service.go.tmpl": "cmd/{{if .IsAccounts}}account{{else}}workspace{{end}}/{{(.TrimPrefix \"account\").KebabName}}/{{(.TrimPrefix \"account\").KebabName}}.go"
".codegen/service.go.tmpl": "cmd/{{if .IsAccounts}}account{{else}}workspace{{end}}/{{(.TrimPrefix \"account\").KebabName}}/{{(.TrimPrefix \"account\").KebabName}}.go",
".codegen/cmd_script.tmpl": "acceptance/help/cmd/{{if .IsAccounts}}account{{else}}workspace{{end}}/{{(.TrimPrefix \"account\").KebabName}}/{{(.TrimPrefix \"account\").KebabName}}/script"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repeats the KebabName twice. Intentional or can we use 1x?

},
"batch": {
".codegen/cmds-workspace.go.tmpl": "cmd/workspace/cmd.go",
".codegen/cmds-account.go.tmpl": "cmd/account/cmd.go"
},
"toolchain": {
"required": ["go"],
"required": [
"go"
],
"post_generate": [
"go test ./acceptance -v -update -run 'TestAccept/help/cmd' ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace + quotes are not needed.

"go test -timeout 240s -run TestConsistentDatabricksSdkVersion github.com/databricks/cli/internal/build",
"make schema",
"echo 'bundle/internal/tf/schema/\\*.go linguist-generated=true' >> ./.gitattributes",
Expand Down
6 changes: 6 additions & 0 deletions .codegen/cmd_script.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
{{- $isAccount := .IsAccounts }}
{{- $cmdGrp := (.TrimPrefix "account").KebabName }}
{{- range .Methods}}
trace $CLI {{if $isAccount }}account {{end}}{{$cmdGrp}} {{.KebabName}} --help
{{- end}}
136 changes: 136 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,139 @@
acceptance/help/cmd/account/access-control/access-control/script linguist-generated=true
acceptance/help/cmd/account/billable-usage/billable-usage/script linguist-generated=true
acceptance/help/cmd/account/budgets/budgets/script linguist-generated=true
acceptance/help/cmd/account/credentials/credentials/script linguist-generated=true
acceptance/help/cmd/account/csp-enablement-account/csp-enablement-account/script linguist-generated=true
acceptance/help/cmd/account/custom-app-integration/custom-app-integration/script linguist-generated=true
acceptance/help/cmd/account/disable-legacy-features/disable-legacy-features/script linguist-generated=true
acceptance/help/cmd/account/encryption-keys/encryption-keys/script linguist-generated=true
acceptance/help/cmd/account/esm-enablement-account/esm-enablement-account/script linguist-generated=true
acceptance/help/cmd/account/federation-policy/federation-policy/script linguist-generated=true
acceptance/help/cmd/account/groups/groups/script linguist-generated=true
acceptance/help/cmd/account/ip-access-lists/ip-access-lists/script linguist-generated=true
acceptance/help/cmd/account/log-delivery/log-delivery/script linguist-generated=true
acceptance/help/cmd/account/metastore-assignments/metastore-assignments/script linguist-generated=true
acceptance/help/cmd/account/metastores/metastores/script linguist-generated=true
acceptance/help/cmd/account/network-connectivity/network-connectivity/script linguist-generated=true
acceptance/help/cmd/account/networks/networks/script linguist-generated=true
acceptance/help/cmd/account/o-auth-published-apps/o-auth-published-apps/script linguist-generated=true
acceptance/help/cmd/account/personal-compute/personal-compute/script linguist-generated=true
acceptance/help/cmd/account/private-access/private-access/script linguist-generated=true
acceptance/help/cmd/account/published-app-integration/published-app-integration/script linguist-generated=true
acceptance/help/cmd/account/service-principal-federation-policy/service-principal-federation-policy/script linguist-generated=true
acceptance/help/cmd/account/service-principal-secrets/service-principal-secrets/script linguist-generated=true
acceptance/help/cmd/account/service-principals/service-principals/script linguist-generated=true
acceptance/help/cmd/account/settings/settings/script linguist-generated=true
acceptance/help/cmd/account/storage-credentials/storage-credentials/script linguist-generated=true
acceptance/help/cmd/account/storage/storage/script linguist-generated=true
acceptance/help/cmd/account/usage-dashboards/usage-dashboards/script linguist-generated=true
acceptance/help/cmd/account/users/users/script linguist-generated=true
acceptance/help/cmd/account/vpc-endpoints/vpc-endpoints/script linguist-generated=true
acceptance/help/cmd/account/workspace-assignment/workspace-assignment/script linguist-generated=true
acceptance/help/cmd/account/workspaces/workspaces/script linguist-generated=true
acceptance/help/cmd/workspace/access-control-proxy/access-control-proxy/script linguist-generated=true
acceptance/help/cmd/workspace/access-control/access-control/script linguist-generated=true
acceptance/help/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy/script linguist-generated=true
acceptance/help/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains/script linguist-generated=true
acceptance/help/cmd/workspace/alerts-legacy/alerts-legacy/script linguist-generated=true
acceptance/help/cmd/workspace/alerts/alerts/script linguist-generated=true
acceptance/help/cmd/workspace/apps/apps/script linguist-generated=true
acceptance/help/cmd/workspace/artifact-allowlists/artifact-allowlists/script linguist-generated=true
acceptance/help/cmd/workspace/automatic-cluster-update/automatic-cluster-update/script linguist-generated=true
acceptance/help/cmd/workspace/catalogs/catalogs/script linguist-generated=true
acceptance/help/cmd/workspace/clean-room-assets/clean-room-assets/script linguist-generated=true
acceptance/help/cmd/workspace/clean-room-task-runs/clean-room-task-runs/script linguist-generated=true
acceptance/help/cmd/workspace/clean-rooms/clean-rooms/script linguist-generated=true
acceptance/help/cmd/workspace/cluster-policies/cluster-policies/script linguist-generated=true
acceptance/help/cmd/workspace/clusters/clusters/script linguist-generated=true
acceptance/help/cmd/workspace/command-execution/command-execution/script linguist-generated=true
acceptance/help/cmd/workspace/compliance-security-profile/compliance-security-profile/script linguist-generated=true
acceptance/help/cmd/workspace/connections/connections/script linguist-generated=true
acceptance/help/cmd/workspace/consumer-fulfillments/consumer-fulfillments/script linguist-generated=true
acceptance/help/cmd/workspace/consumer-installations/consumer-installations/script linguist-generated=true
acceptance/help/cmd/workspace/consumer-listings/consumer-listings/script linguist-generated=true
acceptance/help/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests/script linguist-generated=true
acceptance/help/cmd/workspace/consumer-providers/consumer-providers/script linguist-generated=true
acceptance/help/cmd/workspace/credentials-manager/credentials-manager/script linguist-generated=true
acceptance/help/cmd/workspace/credentials/credentials/script linguist-generated=true
acceptance/help/cmd/workspace/current-user/current-user/script linguist-generated=true
acceptance/help/cmd/workspace/dashboard-widgets/dashboard-widgets/script linguist-generated=true
acceptance/help/cmd/workspace/dashboards/dashboards/script linguist-generated=true
acceptance/help/cmd/workspace/data-sources/data-sources/script linguist-generated=true
acceptance/help/cmd/workspace/dbfs/dbfs/script linguist-generated=true
acceptance/help/cmd/workspace/dbsql-permissions/dbsql-permissions/script linguist-generated=true
acceptance/help/cmd/workspace/default-namespace/default-namespace/script linguist-generated=true
acceptance/help/cmd/workspace/disable-legacy-access/disable-legacy-access/script linguist-generated=true
acceptance/help/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs/script linguist-generated=true
acceptance/help/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring/script linguist-generated=true
acceptance/help/cmd/workspace/experiments/experiments/script linguist-generated=true
acceptance/help/cmd/workspace/external-locations/external-locations/script linguist-generated=true
acceptance/help/cmd/workspace/files/files/script linguist-generated=true
acceptance/help/cmd/workspace/functions/functions/script linguist-generated=true
acceptance/help/cmd/workspace/genie/genie/script linguist-generated=true
acceptance/help/cmd/workspace/git-credentials/git-credentials/script linguist-generated=true
acceptance/help/cmd/workspace/global-init-scripts/global-init-scripts/script linguist-generated=true
acceptance/help/cmd/workspace/grants/grants/script linguist-generated=true
acceptance/help/cmd/workspace/groups/groups/script linguist-generated=true
acceptance/help/cmd/workspace/instance-pools/instance-pools/script linguist-generated=true
acceptance/help/cmd/workspace/instance-profiles/instance-profiles/script linguist-generated=true
acceptance/help/cmd/workspace/ip-access-lists/ip-access-lists/script linguist-generated=true
acceptance/help/cmd/workspace/jobs/jobs/script linguist-generated=true
acceptance/help/cmd/workspace/lakeview/lakeview/script linguist-generated=true
acceptance/help/cmd/workspace/libraries/libraries/script linguist-generated=true
acceptance/help/cmd/workspace/metastores/metastores/script linguist-generated=true
acceptance/help/cmd/workspace/model-registry/model-registry/script linguist-generated=true
acceptance/help/cmd/workspace/model-versions/model-versions/script linguist-generated=true
acceptance/help/cmd/workspace/notification-destinations/notification-destinations/script linguist-generated=true
acceptance/help/cmd/workspace/online-tables/online-tables/script linguist-generated=true
acceptance/help/cmd/workspace/permission-migration/permission-migration/script linguist-generated=true
acceptance/help/cmd/workspace/permissions/permissions/script linguist-generated=true
acceptance/help/cmd/workspace/pipelines/pipelines/script linguist-generated=true
acceptance/help/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters/script linguist-generated=true
acceptance/help/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs/script linguist-generated=true
acceptance/help/cmd/workspace/policy-families/policy-families/script linguist-generated=true
acceptance/help/cmd/workspace/provider-exchange-filters/provider-exchange-filters/script linguist-generated=true
acceptance/help/cmd/workspace/provider-exchanges/provider-exchanges/script linguist-generated=true
acceptance/help/cmd/workspace/provider-files/provider-files/script linguist-generated=true
acceptance/help/cmd/workspace/provider-listings/provider-listings/script linguist-generated=true
acceptance/help/cmd/workspace/provider-personalization-requests/provider-personalization-requests/script linguist-generated=true
acceptance/help/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards/script linguist-generated=true
acceptance/help/cmd/workspace/provider-providers/provider-providers/script linguist-generated=true
acceptance/help/cmd/workspace/providers/providers/script linguist-generated=true
acceptance/help/cmd/workspace/quality-monitors/quality-monitors/script linguist-generated=true
acceptance/help/cmd/workspace/queries-legacy/queries-legacy/script linguist-generated=true
acceptance/help/cmd/workspace/queries/queries/script linguist-generated=true
acceptance/help/cmd/workspace/query-history/query-history/script linguist-generated=true
acceptance/help/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy/script linguist-generated=true
acceptance/help/cmd/workspace/query-visualizations/query-visualizations/script linguist-generated=true
acceptance/help/cmd/workspace/recipient-activation/recipient-activation/script linguist-generated=true
acceptance/help/cmd/workspace/recipients/recipients/script linguist-generated=true
acceptance/help/cmd/workspace/registered-models/registered-models/script linguist-generated=true
acceptance/help/cmd/workspace/repos/repos/script linguist-generated=true
acceptance/help/cmd/workspace/resource-quotas/resource-quotas/script linguist-generated=true
acceptance/help/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins/script linguist-generated=true
acceptance/help/cmd/workspace/schemas/schemas/script linguist-generated=true
acceptance/help/cmd/workspace/secrets/secrets/script linguist-generated=true
acceptance/help/cmd/workspace/service-principals/service-principals/script linguist-generated=true
acceptance/help/cmd/workspace/serving-endpoints-data-plane/serving-endpoints-data-plane/script linguist-generated=true
acceptance/help/cmd/workspace/serving-endpoints/serving-endpoints/script linguist-generated=true
acceptance/help/cmd/workspace/settings/settings/script linguist-generated=true
acceptance/help/cmd/workspace/shares/shares/script linguist-generated=true
acceptance/help/cmd/workspace/statement-execution/statement-execution/script linguist-generated=true
acceptance/help/cmd/workspace/storage-credentials/storage-credentials/script linguist-generated=true
acceptance/help/cmd/workspace/system-schemas/system-schemas/script linguist-generated=true
acceptance/help/cmd/workspace/table-constraints/table-constraints/script linguist-generated=true
acceptance/help/cmd/workspace/tables/tables/script linguist-generated=true
acceptance/help/cmd/workspace/temporary-table-credentials/temporary-table-credentials/script linguist-generated=true
acceptance/help/cmd/workspace/token-management/token-management/script linguist-generated=true
acceptance/help/cmd/workspace/tokens/tokens/script linguist-generated=true
acceptance/help/cmd/workspace/users/users/script linguist-generated=true
acceptance/help/cmd/workspace/vector-search-endpoints/vector-search-endpoints/script linguist-generated=true
acceptance/help/cmd/workspace/vector-search-indexes/vector-search-indexes/script linguist-generated=true
acceptance/help/cmd/workspace/volumes/volumes/script linguist-generated=true
acceptance/help/cmd/workspace/warehouses/warehouses/script linguist-generated=true
acceptance/help/cmd/workspace/workspace-bindings/workspace-bindings/script linguist-generated=true
acceptance/help/cmd/workspace/workspace-conf/workspace-conf/script linguist-generated=true
acceptance/help/cmd/workspace/workspace/workspace/script linguist-generated=true
cmd/account/access-control/access-control.go linguist-generated=true
cmd/account/billable-usage/billable-usage.go linguist-generated=true
cmd/account/budgets/budgets.go linguist-generated=true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

>>> $CLI account access-control get-assignable-roles-for-resource --help
Get assignable roles for a resource.

Gets all the roles that can be granted on an account level resource. A role is
grantable if the rule set on the resource can contain an access rule of the
role.

Arguments:
RESOURCE: The resource name for which assignable roles will be listed.

Usage:
databricks account access-control get-assignable-roles-for-resource RESOURCE [flags]

Flags:
-h, --help help for get-assignable-roles-for-resource

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)

>>> $CLI account access-control get-rule-set --help
Get a rule set.

Get a rule set by its name. A rule set is always attached to a resource and
contains a list of access rules on the said resource. Currently only a default
rule set for each resource is supported.

Arguments:
NAME: The ruleset name associated with the request.
ETAG: Etag used for versioning. The response is at least as fresh as the eTag
provided. Etag is used for optimistic concurrency control as a way to help
prevent simultaneous updates of a rule set from overwriting each other. It
is strongly suggested that systems make use of the etag in the read ->
modify -> write pattern to perform rule set updates in order to avoid race
conditions that is get an etag from a GET rule set request, and pass it
with the PUT update request to identify the rule set version you are
updating.

Usage:
databricks account access-control get-rule-set NAME ETAG [flags]

Flags:
-h, --help help for get-rule-set

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)

>>> $CLI account access-control update-rule-set --help
Update a rule set.

Replace the rules of a rule set. First, use get to read the current version of
the rule set before modifying it. This pattern helps prevent conflicts between
concurrent updates.

Usage:
databricks account access-control update-rule-set [flags]

Flags:
-h, --help help for update-rule-set
--json JSON either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes))

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

>>> $CLI account billable-usage download --help
Return billable usage logs.

Returns billable usage logs in CSV format for the specified account and date
range. For the data schema, see [CSV file schema]. Note that this method might
take multiple minutes to complete.

**Warning**: Depending on the queried date range, the number of workspaces in
the account, the size of the response and the internet speed of the caller,
this API may hit a timeout after a few minutes. If you experience this, try to
mitigate by calling the API with narrower date ranges.

[CSV file schema]: https://docs.databricks.com/administration-guide/account-settings/usage-analysis.html#schema

Arguments:
START_MONTH: Format: YYYY-MM. First month to return billable usage logs for. This
field is required.
END_MONTH: Format: YYYY-MM. Last month to return billable usage logs for. This
field is required.

Usage:
databricks account billable-usage download START_MONTH END_MONTH [flags]

Flags:
-h, --help help for download
--personal-data Specify whether to include personally identifiable information in the billable usage logs, for example the email addresses of cluster creators.

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)

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

Loading