Skip to content

Commit

Permalink
testName to testSuiteName and scriptName to testName
Browse files Browse the repository at this point in the history
  • Loading branch information
exu committed Feb 10, 2022
1 parent c7575f1 commit 0b9513d
Show file tree
Hide file tree
Showing 27 changed files with 96 additions and 96 deletions.
6 changes: 3 additions & 3 deletions api/v1/kusk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ spec:
scriptContent:
description: script metadata content
type: string
scriptName:
testName:
description: unique script name (CRD Script name)
type: string
scriptType:
Expand Down Expand Up @@ -221,7 +221,7 @@ spec:
name:
description: execution name
type: string
scriptName:
testName:
description: name of the script
type: string
scriptType:
Expand All @@ -236,7 +236,7 @@ spec:
required:
- id
- name
- scriptName
- testName
- scriptType
- status
type: object
Expand Down
14 changes: 7 additions & 7 deletions api/v1/testkube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ components:
required:
- id
- name
- testName
- testSuiteName
- status
properties:
id:
Expand All @@ -1040,7 +1040,7 @@ components:
name:
type: string
description: execution name
testName:
testSuiteName:
type: string
description: name of the script
status:
Expand Down Expand Up @@ -1074,7 +1074,7 @@ components:
name:
type: string
description: execution name
scriptName:
testName:
type: string
description: script name
status:
Expand Down Expand Up @@ -1134,10 +1134,10 @@ components:
type: string
description: execution id
format: bson objectId
scriptName:
testName:
type: string
description: unique script name (CRD Script name)
scriptNamespace:
testNamespace:
type: string
description: script namespace
scriptType:
Expand Down Expand Up @@ -1227,7 +1227,7 @@ components:
required:
- id
- name
- scriptName
- testName
- scriptType
- status
properties:
Expand All @@ -1238,7 +1238,7 @@ components:
name:
type: string
description: execution name
scriptName:
testName:
type: string
description: name of the script
scriptType:
Expand Down
18 changes: 9 additions & 9 deletions cmd/kubectl-testkube/commands/scripts/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
func NewCreateScriptsCmd() *cobra.Command {

var (
scriptName string
scriptNamespace string
testName string
testNamespace string
scriptContentType string
file string
executorType string
Expand All @@ -33,24 +33,24 @@ func NewCreateScriptsCmd() *cobra.Command {
ui.Logo()

client, _ := common.GetClient(cmd)
script, _ := client.GetScript(scriptName, scriptNamespace)
if scriptName == script.Name {
ui.Failf("Script with name '%s' already exists in namespace %s", scriptName, scriptNamespace)
script, _ := client.GetScript(testName, testNamespace)
if testName == script.Name {
ui.Failf("Script with name '%s' already exists in namespace %s", testName, testNamespace)
}

options, err := NewUpsertScriptOptionsFromFlags(cmd, script)
ui.ExitOnError("getting script options", err)

script, err = client.CreateScript(options)
ui.ExitOnError("creating script "+scriptName+" in namespace "+scriptNamespace, err)
ui.ExitOnError("creating script "+testName+" in namespace "+testNamespace, err)

ui.Success("Script created", scriptNamespace, "/", scriptName)
ui.Success("Script created", testNamespace, "/", testName)
},
}

cmd.Flags().StringVarP(&scriptName, "name", "n", "", "unique script name - mandatory")
cmd.Flags().StringVarP(&testName, "name", "n", "", "unique script name - mandatory")
cmd.Flags().StringVarP(&file, "file", "f", "", "script file - will be read from stdin if not specified")
cmd.Flags().StringVarP(&scriptNamespace, "script-namespace", "", "testkube", "namespace where script will be created defaults to 'testkube' namespace")
cmd.Flags().StringVarP(&testNamespace, "script-namespace", "", "testkube", "namespace where script will be created defaults to 'testkube' namespace")
cmd.Flags().StringVarP(&scriptContentType, "script-content-type", "", "", "content type of script one of string|file-uri|git-file|git-dir")

cmd.Flags().StringVarP(&executorType, "type", "t", "", "script type (defaults to postman-collection)")
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-testkube/commands/scripts/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func NewDeleteScriptsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "delete <scriptName>",
Use: "delete <testName>",
Short: "Delete scripts",
Args: validator.ScriptName,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-testkube/commands/scripts/executions.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func NewListExecutionsCmd() *cobra.Command {
var tags []string

cmd := &cobra.Command{
Use: "executions [scriptName]",
Use: "executions [testName]",
Aliases: []string{"el"},
Short: "List scripts executions",
Long: `Getting list of execution for given script name or recent executions if there is no script name passed`,
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-testkube/commands/scripts/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func NewGetScriptsCmd() *cobra.Command {
return &cobra.Command{
Use: "get <scriptName>",
Use: "get <testName>",
Aliases: []string{"g"},
Short: "Get script by name",
Long: `Getting script from given namespace - if no namespace given "testkube" namespace is used`,
Expand Down
8 changes: 4 additions & 4 deletions cmd/kubectl-testkube/commands/scripts/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ func NewStartScriptCmd() *cobra.Command {
)

cmd := &cobra.Command{
Use: "start <scriptName>",
Use: "start <testName>",
Aliases: []string{"run", "r"},
Short: "Starts new script",
Long: `Starts new script based on Script Custom Resource name, returns results to console`,
Args: validator.ScriptName,
Run: func(cmd *cobra.Command, args []string) {
ui.Logo()

scriptName := args[0]
testName := args[0]

client, namespace := common.GetClient(cmd)
namespacedName := fmt.Sprintf("%s/%s", namespace, scriptName)
namespacedName := fmt.Sprintf("%s/%s", namespace, testName)

execution, err := client.ExecuteScript(scriptName, namespace, name, params, paramsFileContent)
execution, err := client.ExecuteScript(testName, namespace, name, params, paramsFileContent)
ui.ExitOnError("starting script execution "+namespacedName, err)

printExecutionDetails(execution)
Expand Down
18 changes: 9 additions & 9 deletions cmd/kubectl-testkube/commands/scripts/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
func NewUpdateScriptsCmd() *cobra.Command {

var (
scriptName string
scriptNamespace string
testName string
testNamespace string
scriptContentType string
file string
executorType string
Expand All @@ -32,24 +32,24 @@ func NewUpdateScriptsCmd() *cobra.Command {
var err error

client, _ := common.GetClient(cmd)
script, _ := client.GetScript(scriptName, scriptNamespace)
if scriptName != script.Name {
ui.Failf("Script with name '%s' not exists in namespace %s", scriptName, scriptNamespace)
script, _ := client.GetScript(testName, testNamespace)
if testName != script.Name {
ui.Failf("Script with name '%s' not exists in namespace %s", testName, testNamespace)
}

options, err := NewUpsertScriptOptionsFromFlags(cmd, script)
ui.ExitOnError("getting script options", err)

script, err = client.UpdateScript(options)
ui.ExitOnError("updating script "+scriptName+" in namespace "+scriptNamespace, err)
ui.ExitOnError("updating script "+testName+" in namespace "+testNamespace, err)

ui.Success("Script updated", scriptNamespace, "/", scriptName)
ui.Success("Script updated", testNamespace, "/", testName)
},
}

cmd.Flags().StringVarP(&scriptName, "name", "n", "", "unique script name - mandatory")
cmd.Flags().StringVarP(&testName, "name", "n", "", "unique script name - mandatory")
cmd.Flags().StringVarP(&file, "file", "f", "", "script file - will try to read content from stdin if not specified")
cmd.Flags().StringVarP(&scriptNamespace, "script-namespace", "", "testkube", "namespace where script will be created defaults to 'testkube' namespace")
cmd.Flags().StringVarP(&testNamespace, "script-namespace", "", "testkube", "namespace where script will be created defaults to 'testkube' namespace")
cmd.Flags().StringVarP(&scriptContentType, "script-content-type", "", "", "content type of script one of string|file-uri|git-file|git-dir")

cmd.Flags().StringVarP(&executorType, "type", "t", "", "script type (defaults to postman-collection)")
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-testkube/commands/tests/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func NewDeleteTestCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "delete <testName>",
Use: "delete <testSuiteName>",
Short: "Delete tests",
Long: `Delete tests by name`,
Args: validator.TestName,
Expand Down
8 changes: 4 additions & 4 deletions cmd/kubectl-testkube/commands/tests/executions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ func NewTestExecutionsCmd() *cobra.Command {
)

cmd := &cobra.Command{
Use: "executions [testName]",
Use: "executions [testSuiteName]",
Aliases: []string{"el"},
Short: "Gets tests executions list",
Long: `Gets tests executions list, can be filtered by test name`,
Run: func(cmd *cobra.Command, args []string) {
ui.Logo()

var testName string
var testSuiteName string
if len(args) > 0 {
testName = args[0]
testSuiteName = args[0]
}

client, _ := common.GetClient(cmd)

executions, err := client.ListTestExecutions(testName, limit, tags)
executions, err := client.ListTestExecutions(testSuiteName, limit, tags)
ui.ExitOnError("getting tests executions list", err)

ui.Table(executions, os.Stdout)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-testkube/commands/tests/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func NewGetTestCmd() *cobra.Command {
return &cobra.Command{
Use: "get <testName>",
Use: "get <testSuiteName>",
Aliases: []string{"g"},
Short: "Get test by name",
Long: `Getting test from given namespace - if no namespace given "testkube" namespace is used`,
Expand Down
8 changes: 4 additions & 4 deletions cmd/kubectl-testkube/commands/tests/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ func NewStartTestCmd() *cobra.Command {
)

cmd := &cobra.Command{
Use: "start <testName>",
Use: "start <testSuiteName>",
Aliases: []string{"run", "r"},
Short: "Starts new test",
Long: `Starts new test based on Test Custom Resource name, returns results to console`,
Args: validator.TestName,
Run: func(cmd *cobra.Command, args []string) {
ui.Logo()

testName := args[0]
testSuiteName := args[0]
startTime := time.Now()

client, namespace := common.GetClient(cmd)
namespacedName := fmt.Sprintf("%s/%s", namespace, testName)
namespacedName := fmt.Sprintf("%s/%s", namespace, testSuiteName)

execution, err := client.ExecuteTest(testName, namespace, name, params)
execution, err := client.ExecuteTest(testSuiteName, namespace, name, params)
ui.ExitOnError("starting test execution "+namespacedName, err)

if watchEnabled {
Expand Down

0 comments on commit 0b9513d

Please sign in to comment.