Skip to content

Commit

Permalink
Add usage snapshot test (#1144)
Browse files Browse the repository at this point in the history
Adding snapshot tests as coverage for command design changes.
  • Loading branch information
weikanglim authored Nov 14, 2022
1 parent 600f686 commit ddad650
Show file tree
Hide file tree
Showing 39 changed files with 628 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.go text eol=lf
*.snap text eol=lf
*.txt text eol=lf
1 change: 1 addition & 0 deletions .vscode/cspell-github-user-aliases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ sethvargo
stretchr
theckman
benbjohnson
bradleyjkemp
2 changes: 2 additions & 0 deletions cli/azd/.vscode/cspell-azd-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cflags
cmdsubst
containerapp
csharpapp
cupaloy
devel
dockerproject
dskip
Expand Down Expand Up @@ -70,6 +71,7 @@ rzip
semconv
serverfarms
setenvs
snapshotter
sstore
staticcheck
staticwebapp
Expand Down
13 changes: 13 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-config-get.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Usage:
azd config get <path> [flags]

Flags:
-h, --help Gets help for get.
-o, --output string The output format (the supported formats are json). (default "json")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

13 changes: 13 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-config-list.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Usage:
azd config list [flags]

Flags:
-h, --help Gets help for list.
-o, --output string The output format (the supported formats are json). (default "json")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

12 changes: 12 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Usage:
azd config reset [flags]

Flags:
-h, --help Gets help for reset.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

16 changes: 16 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-config-set.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Usage:
azd config set <path> <value> [flags]

Examples:
$ azd config set defaults.subscription <yourSubscriptionID>
$ azd config set defaults.location eastus

Flags:
-h, --help Gets help for set.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

15 changes: 15 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Usage:
azd config unset <path> [flags]

Examples:
$ azd config unset defaults.location

Flags:
-h, --help Gets help for unset.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

21 changes: 21 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-config.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Usage:
azd config [command]

Available Commands:
get Gets a configuration
list Lists all configuration values
reset Resets configuration to default
set Sets a configuration
unset Unsets a configuration

Flags:
-h, --help Gets help for config.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

Use "azd config [command] --help" for more information about a command.

14 changes: 14 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-deploy.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Usage:
azd deploy [flags]

Flags:
-h, --help Gets help for deploy.
-o, --output string The output format (the supported formats are json, none). (default "none")
--service string Deploys a specific service (when the string is unspecified, all services that are listed in the azure.yaml file are deployed).

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

15 changes: 15 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-down.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Usage:
azd down [flags]

Flags:
--force Does not require confirmation before it deletes resources.
-h, --help Gets help for down.
-o, --output string The output format (the supported formats are json, none). (default "none")
--purge Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

13 changes: 13 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env-get-values.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Usage:
azd env get-values [flags]

Flags:
-h, --help Gets help for get-values.
-o, --output string The output format (the supported formats are json, dotenv). (default "dotenv")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

16 changes: 16 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env-list.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Usage:
azd env list [flags]

Aliases:
list, ls

Flags:
-h, --help Gets help for list.
-o, --output string The output format (the supported formats are json, table). (default "table")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

14 changes: 14 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env-new.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Usage:
azd env new <environment> [flags]

Flags:
-h, --help Gets help for new.
-l, --location string Azure location for the new environment
--subscription string Name or ID of an Azure subscription to use for the new environment

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

13 changes: 13 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env-refresh.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Usage:
azd env refresh [flags]

Flags:
-h, --help Gets help for refresh.
-o, --output string The output format (the supported formats are json, none). (default "none")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

12 changes: 12 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env-select.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Usage:
azd env select <environment> [flags]

Flags:
-h, --help Gets help for select.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

12 changes: 12 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env-set.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Usage:
azd env set <key> <value> [flags]

Flags:
-h, --help Gets help for set.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

22 changes: 22 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-env.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Usage:
azd env [command]

Available Commands:
get-values Get all environment values.
list List environments
new Create a new environment.
refresh Refresh environment settings by using information from a previous infrastructure provision.
select Set the default environment.
set Set a value in the environment.

Flags:
-h, --help Gets help for env.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

Use "azd env [command] --help" for more information about a command.

17 changes: 17 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-infra-create.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Usage:
azd infra create [flags]

Aliases:
create, provision

Flags:
-h, --help Gets help for create.
--no-progress Suppresses progress information.
-o, --output string The output format (the supported formats are json, none). (default "none")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

14 changes: 14 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-infra-delete.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Usage:
azd infra delete [flags]

Flags:
--force Does not require confirmation before it deletes resources.
-h, --help Gets help for delete.
--purge Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

18 changes: 18 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-infra.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Usage:
azd infra [command]

Available Commands:
create Create Azure resources for an application.
delete Delete Azure resources for an application.

Flags:
-h, --help Gets help for infra.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

Use "azd infra [command] --help" for more information about a command.

16 changes: 16 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-init.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Usage:
azd init [flags]

Flags:
-b, --branch string The template branch to initialize from.
-h, --help Gets help for init.
-l, --location string Azure location for the new environment
--subscription string Name or ID of an Azure subscription to use for the new environment
-t, --template string The template to use when you initialize the project. You can use Full URI, <owner>/<repository>, or <repository> if it's part of the azure-samples organization.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

21 changes: 21 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-login.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Usage:
azd login [flags]

Flags:
--check-status Checks the log-in status instead of logging in.
--client-certificate string The path to the client certificate for the service principal to authenticate with.
--client-id string The client id for the service principal to authenticate with.
--client-secret string The client secret for the service principal to authenticate with. Set to the empty string to read the value from the console.
--federated-credential string The federated token for the service principal to authenticate with. Set to the empty string to read the value from the console.
--federated-credential-provider string The provider to use to acquire a federated token to authenticate with.
-h, --help Gets help for login.
-o, --output string The output format (the supported formats are json, none). (default "none")
--tenant-id string The tenant id for the service principal to authenticate with.
--use-device-code When true, log in by using a device code instead of a browser.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

12 changes: 12 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-logout.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Usage:
azd logout [flags]

Flags:
-h, --help Gets help for logout.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

15 changes: 15 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-monitor.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Usage:
azd monitor [flags]

Flags:
-h, --help Gets help for monitor.
--live Open a browser to Application Insights Live Metrics. Live Metrics is currently not supported for Python applications.
--logs Open a browser to Application Insights Logs.
--overview Open a browser to Application Insights Overview Dashboard.

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

17 changes: 17 additions & 0 deletions cli/azd/cmd/testdata/TestUsage-azd-pipeline-config.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Usage:
azd pipeline config [flags]

Flags:
--auth-type string The authentication type used between the pipeline provider and Azure for deployment (Only valid for GitHub provider)
-h, --help Gets help for config.
--principal-name string The name of the service principal to use to grant access to Azure resources as part of the pipeline.
--principal-role string The role to assign to the service principal. (default "Contributor")
--provider string The pipeline provider to use (GitHub and Azdo supported).
--remote-name string The name of the git remote to configure the pipeline to run on. (default "origin")

Global Flags:
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-e, --environment string The name of the environment to use.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.

Loading

0 comments on commit ddad650

Please sign in to comment.