Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/importURL.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewImportURLCommand() *cobra.Command {
os.Exit(1)
}

specificationFiles := os.Args[2]
specificationFiles := args[0]

// Collect optional HTTPS transport flags.
if insecureTLS {
Expand Down
18 changes: 8 additions & 10 deletions cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import (
)

var (
runnerChoices = map[string]bool{"HTTP": true, "SOAP_HTTP": true, "SOAP_UI": true, "POSTMAN": true, "OPEN_API_SCHEMA": true, "ASYNC_API_SCHEMA": true, "GRPC_PROTOBUF": true, "GRAPHQL_SCHEMA": true}
timeUnitChoices = map[string]bool{"milli": true, "sec": true, "min": true}
runnerChoices = map[string]bool{"HTTP": true, "SOAP_HTTP": true, "SOAP_UI": true, "POSTMAN": true, "OPEN_API_SCHEMA": true, "ASYNC_API_SCHEMA": true, "GRPC_PROTOBUF": true, "GRAPHQL_SCHEMA": true}
)

func NewTestCommand() *cobra.Command {
Expand Down Expand Up @@ -58,20 +57,20 @@ func NewTestCommand() *cobra.Command {
os.Exit(1)
}

serviceRef := os.Args[2]
testEndpoint := os.Args[3]
runnerType := os.Args[4]
serviceRef := args[0]
testEndpoint := args[1]
runnerType := args[2]

// Validate presence and values of args.
if &serviceRef == nil || strings.HasPrefix(serviceRef, "-") {
if len(serviceRef) == 0 || strings.HasPrefix(serviceRef, "-") {
fmt.Println("test command require <apiName:apiVersion> <testEndpoint> <runner> args")
os.Exit(1)
}
if &testEndpoint == nil || strings.HasPrefix(testEndpoint, "-") {
if len(testEndpoint) == 0 || strings.HasPrefix(testEndpoint, "-") {
fmt.Println("test command require <apiName:apiVersion> <testEndpoint> <runner> args")
os.Exit(1)
}
if &runnerType == nil || strings.HasPrefix(runnerType, "-") {
if len(runnerType) == 0 || strings.HasPrefix(runnerType, "-") {
fmt.Println("test command require <apiName:apiVersion> <testEndpoint> <runner> args")
os.Exit(1)
}
Expand All @@ -81,9 +80,8 @@ func NewTestCommand() *cobra.Command {
}

// Validate presence and values of flags.
if &waitFor == nil || (!strings.HasSuffix(waitFor, "milli") && !strings.HasSuffix(waitFor, "sec") && !strings.HasSuffix(waitFor, "min")) {
if !strings.HasSuffix(waitFor, "milli") && !strings.HasSuffix(waitFor, "sec") && !strings.HasSuffix(waitFor, "min") {
fmt.Println("--waitFor format is wrong. Applying default 5sec")
waitFor = "5sec"
}

// Collect optional HTTPS transport flags.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/microcks/microcks-cli

go 1.12

require github.com/spf13/cobra v1.9.1 // indirect
require github.com/spf13/cobra v1.9.1