diff --git a/cmd/new.go b/cmd/new.go index 466325094ce..9cd8c2a5025 100644 --- a/cmd/new.go +++ b/cmd/new.go @@ -54,9 +54,8 @@ func (c *newScriptCmd) run(cmd *cobra.Command, args []string) error { } argsStruct := templates.TemplateArgs{ - ScriptName: target, - EnableCloud: c.projectID != "", - ProjectID: c.projectID, + ScriptName: target, + ProjectID: c.projectID, } if err := templates.ExecuteTemplate(fd, tmpl, argsStruct); err != nil { diff --git a/cmd/newtemplates/browser.js b/cmd/newtemplates/browser.js index 46dbc00f15a..5ef80094e7b 100644 --- a/cmd/newtemplates/browser.js +++ b/cmd/newtemplates/browser.js @@ -14,12 +14,11 @@ export const options = { }, }, }, - }, {{ if .EnableCloud }} - cloud: { {{ if .ProjectID }} - projectID: {{ .ProjectID }}, {{ else }} - // projectID: 12345, // Replace this with your own projectID {{ end }} + },{{ if .ProjectID }} + cloud: { + projectID: {{ .ProjectID }}, name: "{{ .ScriptName }}", - }, {{ end }} + },{{ end }} }; export function setup() { diff --git a/cmd/newtemplates/minimal.js b/cmd/newtemplates/minimal.js index 191ced04806..716c08802ea 100644 --- a/cmd/newtemplates/minimal.js +++ b/cmd/newtemplates/minimal.js @@ -3,12 +3,11 @@ import { sleep, check } from 'k6'; export const options = { vus: 10, - duration: '30s',{{ if .EnableCloud }} - cloud: { {{ if .ProjectID }} - projectID: {{ .ProjectID }}, {{ else }} - // projectID: 12345, // Replace this with your own projectID {{ end }} + duration: '30s',{{ if .ProjectID }} + cloud: { + projectID: {{ .ProjectID }}, name: "{{ .ScriptName }}", - }, {{ end }} + },{{ end }} }; export default function() { diff --git a/cmd/newtemplates/protocol.js b/cmd/newtemplates/protocol.js index 623be6fabe5..f2781c2d7c1 100644 --- a/cmd/newtemplates/protocol.js +++ b/cmd/newtemplates/protocol.js @@ -9,15 +9,15 @@ export const options = { { duration: "10s", target: 5 }, { duration: "20s", target: 10 }, { duration: "1s", target: 0 }, - ], thresholds: { + ], + thresholds: { http_req_failed: ["rate<0.01"], http_req_duration: ["p(95)<500", "p(99)<1000"], - },{{ if .EnableCloud }} - cloud: { {{ if .ProjectID }} - projectID: {{ .ProjectID }}, {{ else }} - // projectID: 12345, // Replace this with your own projectID {{ end }} + },{{ if .ProjectID }} + cloud: { + projectID: {{ .ProjectID }}, name: "{{ .ScriptName }}", - }, {{ end }} + },{{ end }} }; export function setup() { diff --git a/cmd/newtemplates/templates.go b/cmd/newtemplates/templates.go index 538480f6b4b..4b14ffc8a6f 100644 --- a/cmd/newtemplates/templates.go +++ b/cmd/newtemplates/templates.go @@ -28,9 +28,8 @@ var ( // TemplateArgs represents arguments passed to templates type TemplateArgs struct { - ScriptName string - EnableCloud bool - ProjectID string + ScriptName string + ProjectID string } // GetTemplate selects the appropriate template based on the type