Skip to content

Commit 05db3dc

Browse files
authored
test(e2e): update init test's flags to accomodate for jobs (#1564)
_By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 3409447 commit 05db3dc

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

e2e/init/init_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ var _ = Describe("init flow", func() {
2323
BeforeAll(func() {
2424
svcName = "front-end"
2525
_, initErr = cli.Init(&client.InitRequest{
26-
AppName: appName,
27-
SvcName: svcName,
28-
ImageTag: "gallopinggurdey",
29-
Dockerfile: "./front-end/Dockerfile",
30-
SvcType: "Load Balanced Web Service",
31-
Deploy: true,
32-
SvcPort: "80",
26+
AppName: appName,
27+
WorkloadName: svcName,
28+
ImageTag: "gallopinggurdey",
29+
Dockerfile: "./front-end/Dockerfile",
30+
WorkloadType: "Load Balanced Web Service",
31+
Deploy: true,
32+
SvcPort: "80",
3333
})
3434
})
3535

e2e/internal/client/cli.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ type AppInitRequest struct {
2828

2929
// InitRequest contains the parameters for calling copilot init.
3030
type InitRequest struct {
31-
AppName string
32-
SvcName string
33-
Deploy bool
34-
ImageTag string
35-
Dockerfile string
36-
SvcType string
37-
SvcPort string
31+
AppName string
32+
WorkloadName string
33+
Deploy bool
34+
ImageTag string
35+
Dockerfile string
36+
WorkloadType string
37+
SvcPort string
3838
}
3939

4040
// EnvInitRequest contains the parameters for calling copilot env init.
@@ -181,8 +181,8 @@ func (cli *CLI) Init(opts *InitRequest) (string, error) {
181181
return cli.exec(
182182
exec.Command(cli.path, "init",
183183
"--app", opts.AppName,
184-
"--svc", opts.SvcName,
185-
"--svc-type", opts.SvcType,
184+
"--name", opts.WorkloadName,
185+
"--type", opts.WorkloadType,
186186
"--tag", opts.ImageTag,
187187
"--dockerfile", opts.Dockerfile,
188188
"--port", opts.SvcPort,

internal/pkg/cli/flag.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ const (
9292
// Short flag names.
9393
// A short flag only exists if the flag or flag set is mandatory by the command.
9494
const (
95-
nameFlagShort = "n"
96-
appFlagShort = "a"
97-
envFlagShort = "e"
98-
svcFlagShort = "s"
99-
svcTypeFlagShort = "t"
100-
jobTypeFlagShort = "t"
95+
nameFlagShort = "n"
96+
appFlagShort = "a"
97+
envFlagShort = "e"
98+
svcFlagShort = "s"
99+
typeFlagShort = "t"
101100

102101
dockerFileFlagShort = "d"
103102
imageFlagShort = "i"
@@ -141,6 +140,7 @@ const (
141140
envFlagDescription = "Name of the environment."
142141
svcFlagDescription = "Name of the service."
143142
jobFlagDescription = "Name of the job."
143+
workloadFlagDescription = "Name of the service or job."
144144
pipelineFlagDescription = "Name of the pipeline."
145145
profileFlagDescription = "Name of the profile."
146146
yesFlagDescription = "Skips confirmation prompt."
@@ -163,7 +163,7 @@ Defaults to all logs. Only one of start-time / since may be used.`
163163
Defaults to all logs. Only one of end-time / follow may be used.`
164164
tasksLogsFlagDescription = "Optional. Only return logs from specific task IDs."
165165

166-
deployTestFlagDescription = `Deploy your service to a "test" environment.`
166+
deployTestFlagDescription = `Deploy your service or job to a "test" environment.`
167167
githubURLFlagDescription = "GitHub repository URL for your service."
168168
githubAccessTokenFlagDescription = "GitHub personal access token for your repository."
169169
gitBranchFlagDescription = "Branch used to trigger your pipeline."

internal/pkg/cli/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ func BuildInitCmd() *cobra.Command {
433433
}),
434434
}
435435
cmd.Flags().StringVarP(&vars.appName, appFlag, appFlagShort, tryReadingAppName(), appFlagDescription)
436-
cmd.Flags().StringVarP(&vars.svcName, nameFlag, svcFlagShort, "", svcFlagDescription)
437-
cmd.Flags().StringVarP(&vars.wkldType, typeFlag, svcTypeFlagShort, "", wkldTypeFlagDescription)
436+
cmd.Flags().StringVarP(&vars.svcName, nameFlag, nameFlagShort, "", workloadFlagDescription)
437+
cmd.Flags().StringVarP(&vars.wkldType, typeFlag, typeFlagShort, "", wkldTypeFlagDescription)
438438
cmd.Flags().StringVarP(&vars.dockerfilePath, dockerFileFlag, dockerFileFlagShort, "", dockerFileFlagDescription)
439439
cmd.Flags().StringVarP(&vars.image, imageFlag, imageFlagShort, "", imageFlagDescription)
440440
cmd.Flags().BoolVar(&vars.shouldDeploy, deployFlag, false, deployTestFlagDescription)

internal/pkg/cli/job_init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ func buildJobInitCmd() *cobra.Command {
305305
}
306306
cmd.Flags().StringVarP(&vars.appName, appFlag, appFlagShort, tryReadingAppName(), appFlagDescription)
307307
cmd.Flags().StringVarP(&vars.name, nameFlag, nameFlagShort, "", jobFlagDescription)
308-
cmd.Flags().StringVarP(&vars.wkldType, jobTypeFlag, jobTypeFlagShort, "", jobTypeFlagDescription)
308+
cmd.Flags().StringVarP(&vars.wkldType, jobTypeFlag, typeFlagShort, "", jobTypeFlagDescription)
309309
cmd.Flags().StringVarP(&vars.dockerfilePath, dockerFileFlag, dockerFileFlagShort, "", dockerFileFlagDescription)
310310
cmd.Flags().StringVarP(&vars.schedule, scheduleFlag, scheduleFlagShort, "", scheduleFlagDescription)
311311
cmd.Flags().StringVar(&vars.timeout, timeoutFlag, "", timeoutFlagDescription)

internal/pkg/cli/storage_init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ environment variables for easy access.`,
579579
}),
580580
}
581581
cmd.Flags().StringVarP(&vars.storageName, nameFlag, nameFlagShort, "", storageFlagDescription)
582-
cmd.Flags().StringVarP(&vars.storageType, storageTypeFlag, svcTypeFlagShort, "", storageTypeFlagDescription)
582+
cmd.Flags().StringVarP(&vars.storageType, storageTypeFlag, typeFlagShort, "", storageTypeFlagDescription)
583583
cmd.Flags().StringVarP(&vars.storageSvc, svcFlag, svcFlagShort, "", storageServiceFlagDescription)
584584

585585
cmd.Flags().StringVar(&vars.partitionKey, storagePartitionKeyFlag, "", storagePartitionKeyFlagDescription)

internal/pkg/cli/svc_init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ This command is also run as part of "copilot init".`,
411411
}
412412
cmd.Flags().StringVarP(&vars.appName, appFlag, appFlagShort, tryReadingAppName(), appFlagDescription)
413413
cmd.Flags().StringVarP(&vars.name, nameFlag, nameFlagShort, "", svcFlagDescription)
414-
cmd.Flags().StringVarP(&vars.wkldType, svcTypeFlag, svcTypeFlagShort, "", svcTypeFlagDescription)
414+
cmd.Flags().StringVarP(&vars.wkldType, svcTypeFlag, typeFlagShort, "", svcTypeFlagDescription)
415415
cmd.Flags().StringVarP(&vars.dockerfilePath, dockerFileFlag, dockerFileFlagShort, "", dockerFileFlagDescription)
416416
cmd.Flags().StringVarP(&vars.image, imageFlag, imageFlagShort, "", imageFlagDescription)
417417

0 commit comments

Comments
 (0)