Skip to content

Commit 780a958

Browse files
Merge pull request #130 from StackVista/STAC24232-rename-test-command
STAC-24232 Rename stackpack `test` command to `test-deploy`
2 parents 7485f81 + f207af4 commit 780a958

4 files changed

Lines changed: 30 additions & 30 deletions

File tree

cmd/stackpack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func StackPackCommand(cli *di.Deps) *cobra.Command {
3232
if os.Getenv(experimentalStackpackEnvVar) != "" {
3333
cmd.AddCommand(stackpack.StackpackScaffoldCommand(cli))
3434
cmd.AddCommand(stackpack.StackpackPackageCommand(cli))
35-
cmd.AddCommand(stackpack.StackpackTestCommand(cli))
35+
cmd.AddCommand(stackpack.StackpackTestDeployCommand(cli))
3636
}
3737

3838
return cmd

cmd/stackpack/stackpack_test_cmd.go renamed to cmd/stackpack/stackpack_test_deploy_cmd.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ const (
2121
stackpackConfigFile = "stackpack.yaml"
2222
)
2323

24-
// TestArgs contains arguments for stackpack test command
25-
type TestArgs struct {
24+
// TestDeployArgs contains arguments for stackpack test-deploy command
25+
type TestDeployArgs struct {
2626
StackpackDir string
2727
Params map[string]string
2828
Yes bool
2929
UnlockedStrategy string
3030
}
3131

32-
// StackpackTestCommand creates the test subcommand
33-
func StackpackTestCommand(cli *di.Deps) *cobra.Command {
34-
args := &TestArgs{
32+
// StackpackTestDeployCommand creates the test-deploy subcommand
33+
func StackpackTestDeployCommand(cli *di.Deps) *cobra.Command {
34+
args := &TestDeployArgs{
3535
Params: make(map[string]string),
3636
}
3737
cmd := &cobra.Command{
38-
Use: "test",
38+
Use: "test-deploy",
3939
Short: "Test a stackpack by packaging, uploading, and installing/upgrading",
4040
Long: `Test a stackpack by running package, upload, and install/upgrade commands in sequence.
4141
@@ -50,17 +50,17 @@ This command will:
5050
The original stackpack directory is left untouched. The version is automatically incremented for each test run.
5151
The stackpack name is read from ` + stackpackConfigFile + `, so no --name flag is required.`,
5252
Example: `# Test stackpack with confirmation
53-
sts stackpack test -p "param1=value1"
53+
sts stackpack test-deploy -p "param1=value1"
5454
5555
# Skip confirmation prompt
56-
sts stackpack test --yes
56+
sts stackpack test-deploy --yes
5757
5858
# Test stackpack in specific directory with unlocked strategy
59-
sts stackpack test -d ./my-stackpack --yes --unlocked-strategy force
59+
sts stackpack test-deploy -d ./my-stackpack --yes --unlocked-strategy force
6060
6161
# Test with custom unlocked strategy
62-
sts stackpack test --unlocked-strategy skip --yes`,
63-
RunE: cli.CmdRunEWithApi(RunStackpackTestCommand(args)),
62+
sts stackpack test-deploy --unlocked-strategy skip --yes`,
63+
RunE: cli.CmdRunEWithApi(RunStackpackTestDeployCommand(args)),
6464
}
6565

6666
cmd.Flags().StringVarP(&args.StackpackDir, "stackpack-directory", "d", "", "Path to stackpack directory (defaults to current directory)")
@@ -71,19 +71,19 @@ sts stackpack test --unlocked-strategy skip --yes`,
7171
return cmd
7272
}
7373

74-
// RunStackpackTestCommand executes the test command
74+
// RunStackpackTestDeployCommand executes the test-deploy command
7575
//
7676
//nolint:funlen
77-
func RunStackpackTestCommand(args *TestArgs) di.CmdWithApiFn {
77+
func RunStackpackTestDeployCommand(args *TestDeployArgs) di.CmdWithApiFn {
7878
return func(
7979
cmd *cobra.Command,
8080
cli *di.Deps,
8181
api *stackstate_api.APIClient,
8282
serverInfo *stackstate_api.ServerInfo,
8383
) common.CLIError {
84-
// Warn if JSON output is requested - not meaningful for test command
84+
// Warn if JSON output is requested - not meaningful for test-deploy command
8585
if cli.IsJson() {
86-
cli.Printer.PrintLn("Warning: JSON output format is not meaningful for the test command, proceeding with text output")
86+
cli.Printer.PrintLn("Warning: JSON output format is not meaningful for the test-deploy command, proceeding with text output")
8787
}
8888

8989
// Set default stackpack directory
@@ -103,7 +103,7 @@ func RunStackpackTestCommand(args *TestArgs) di.CmdWithApiFn {
103103
return common.NewRuntimeError(fmt.Errorf("failed to parse %s: %w", stackpackConfigFile, err))
104104
}
105105

106-
cli.Printer.Success("Starting stackpack test sequence...")
106+
cli.Printer.Success("Starting stackpack test-deploy sequence...")
107107
cli.Printer.PrintLn(fmt.Sprintf(" Stackpack: %s (current version: %s)", originalInfo.Name, originalInfo.Version))
108108
cli.Printer.PrintLn("")
109109

@@ -239,7 +239,7 @@ func RunStackpackTestCommand(args *TestArgs) di.CmdWithApiFn {
239239
}
240240

241241
cli.Printer.PrintLn("")
242-
cli.Printer.Success("🎉 Test sequence completed successfully!")
242+
cli.Printer.Success("🎉 Test-deploy sequence completed successfully!")
243243

244244
// Clean up .sts file
245245
if err := os.Remove(packageArgs.ArchiveFile); err != nil {

cmd/stackpack/stackpack_test_cmd_test.go renamed to cmd/stackpack/stackpack_test_deploy_cmd_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ import (
1414
"github.com/stretchr/testify/require"
1515
)
1616

17-
// setupStackpackTestCmd creates a test command with mock dependencies
18-
func setupStackpackTestCmd(t *testing.T) (*di.MockDeps, *cobra.Command) {
17+
// setupStackpackTestDeployCmd creates a test command with mock dependencies
18+
func setupStackpackTestDeployCmd(t *testing.T) (*di.MockDeps, *cobra.Command) {
1919
cli := di.NewMockDeps(t)
20-
cmd := StackpackTestCommand(&cli.Deps)
20+
cmd := StackpackTestDeployCommand(&cli.Deps)
2121
return &cli, cmd
2222
}
2323

24-
func TestStackpackTestCommand_FlagsAndStructure(t *testing.T) {
25-
_, cmd := setupStackpackTestCmd(t)
24+
func TestStackpackTestDeployCommand_FlagsAndStructure(t *testing.T) {
25+
_, cmd := setupStackpackTestDeployCmd(t)
2626

2727
// Test command structure
28-
assert.Equal(t, "test", cmd.Use)
28+
assert.Equal(t, "test-deploy", cmd.Use)
2929
assert.Contains(t, cmd.Short, "Test a stackpack")
3030
assert.Contains(t, cmd.Long, "package, upload, and install")
3131
assert.NotEmpty(t, cmd.Example)
@@ -163,7 +163,7 @@ func TestCopyDirectory(t *testing.T) {
163163
assert.Equal(t, testContent, string(copiedContent2))
164164
}
165165

166-
func TestStackpackTestCommand_RequiredFlags(t *testing.T) {
166+
func TestStackpackTestDeployCommand_RequiredFlags(t *testing.T) {
167167
tests := []struct {
168168
name string
169169
args []string
@@ -184,7 +184,7 @@ func TestStackpackTestCommand_RequiredFlags(t *testing.T) {
184184

185185
for _, tt := range tests {
186186
t.Run(tt.name, func(t *testing.T) {
187-
cli, cmd := setupStackpackTestCmd(t)
187+
cli, cmd := setupStackpackTestDeployCmd(t)
188188
_, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, tt.args...)
189189

190190
if tt.wantErr {
@@ -202,7 +202,7 @@ func TestStackpackTestCommand_RequiredFlags(t *testing.T) {
202202
}
203203
}
204204

205-
func TestStackpackTestCommand_DirectoryHandling(t *testing.T) {
205+
func TestStackpackTestDeployCommand_DirectoryHandling(t *testing.T) {
206206
// Create temporary directory with valid stackpack structure
207207
tempDir, err := os.MkdirTemp("", "stackpack-test-dir-*")
208208
require.NoError(t, err)
@@ -214,7 +214,7 @@ func TestStackpackTestCommand_DirectoryHandling(t *testing.T) {
214214
// Create required files
215215
createTestStackpack(t, stackpackDir, "test-stackpack", "1.0.0")
216216

217-
cli, cmd := setupStackpackTestCmd(t)
217+
cli, cmd := setupStackpackTestDeployCmd(t)
218218

219219
tests := []struct {
220220
name string
@@ -384,7 +384,7 @@ func TestCompareVersionsSemver(t *testing.T) {
384384
}
385385
}
386386

387-
func TestStackpackTestCommand_InstallUpgradeLogic(t *testing.T) {
387+
func TestStackpackTestDeployCommand_InstallUpgradeLogic(t *testing.T) {
388388
tests := []struct {
389389
name string
390390
installedVersion string

cmd/stackpack_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestStackPackCommand_FeatureGating(t *testing.T) {
4242
},
4343
}
4444

45-
experimentalCommands := []string{"scaffold", "package", "test"}
45+
experimentalCommands := []string{"scaffold", "package", "test-deploy"}
4646

4747
for _, tt := range tests {
4848
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)