Skip to content

Commit

Permalink
fix: executors documentation and remove timeHuman everywhere
Browse files Browse the repository at this point in the history
Signed-off-by: francois  samin <francois.samin@corp.ovh.com>
  • Loading branch information
fsamin committed Nov 20, 2020
1 parent db93a36 commit 410851d
Show file tree
Hide file tree
Showing 18 changed files with 13 additions and 46 deletions.
13 changes: 7 additions & 6 deletions executors/exec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,22 @@ testcases:
## Output
```yaml
executor
systemout
systemoutjson
systemerr
systemerrjson
err
code
timeseconds
timehuman
```

- result.timeseconds & result.timehuman: time of execution
- result.executor.executor.script: script executed
- result.timeseconds: time of execution
- result.err: if exists, this field contains error
- result.systemout: Standard Output of executed script
- result.systemerr: Error Output of executed script
- result.code: Exit Code
- result.systemoutjson: Standard Output of executed script parsed as a JSON object
- result.systemerr: Error output of executed script
- result.systemerrjson: Error output of executed script parsed as a JSON object
- result.code: Exit code

## Default assertion

Expand Down
2 changes: 0 additions & 2 deletions executors/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type Result struct {
Err string `json:"err,omitempty" yaml:"err,omitempty"`
Code string `json:"code,omitempty" yaml:"code,omitempty"`
TimeSeconds float64 `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
TimeHuman string `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
}

// ZeroValueResult return an empty implemtation of this executor result
Expand Down Expand Up @@ -201,7 +200,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

result.Systemout = venom.RemoveNotPrintableChar(strings.TrimRight(result.Systemout, "\n"))
result.Systemerr = venom.RemoveNotPrintableChar(strings.TrimRight(result.Systemerr, "\n"))
Expand Down
3 changes: 1 addition & 2 deletions executors/grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ systemerr
err
code
timeseconds
timehuman
```

- result.timeseconds & result.timehuman: time of execution
- result.timeseconds: execution duration
- result.executor.executor.script: script executed
- result.err: if exists, this field contains error
- result.systemout: Standard Output of executed script
Expand Down
2 changes: 0 additions & 2 deletions executors/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ type Result struct {
Err string `json:"err,omitempty" yaml:"err,omitempty"`
Code string `json:"code,omitempty" yaml:"code,omitempty"`
TimeSeconds float64 `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
TimeHuman string `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
}

type customHandler struct {
Expand Down Expand Up @@ -189,7 +188,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

if handle.err != nil {
result.Err = handle.err.Error()
Expand Down
3 changes: 1 addition & 2 deletions executors/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ testcases:
```
result.request
result.timeseconds
result.timehuman
result.statuscode
result.body
result.bodyjson
result.headers
result.err
```
- result.timeseconds & result.timehuman: time of execution
- result.timeseconds: execution duration
- result.request.method: HTTP method of the request
- result.request.url: HTTP URL of the request
- result.request.body: body content as string
Expand Down
2 changes: 0 additions & 2 deletions executors/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ type Executor struct {
// Result represents a step result. Json and yaml descriptor are used for json output
type Result struct {
TimeSeconds float64 `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
TimeHuman string `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
StatusCode int `json:"statuscode,omitempty" yaml:"statuscode,omitempty"`
Request HTTPRequest `json:"request,omitempty" yaml:"request,omitempty"`
Body string `json:"body,omitempty" yaml:"body,omitempty"`
Expand Down Expand Up @@ -161,7 +160,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i
}
elapsed := time.Since(start)
r.TimeSeconds = elapsed.Seconds()
r.TimeHuman = elapsed.String()

var bb []byte
if resp.Body != nil {
Expand Down
2 changes: 0 additions & 2 deletions executors/imap/imap.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ type Result struct {
Subject string `json:"subject,omitempty" yaml:"subject,omitempty"`
Body string `json:"body,omitempty" yaml:"body,omitempty"`
TimeSeconds float64 `json:"timeSeconds,omitempty" yaml:"timeSeconds,omitempty"`
TimeHuman string `json:"timeHuman,omitempty" yaml:"timeHuman,omitempty"`
}

// ZeroValueResult return an empty implemtation of this executor result
Expand Down Expand Up @@ -91,7 +90,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down
6 changes: 1 addition & 5 deletions executors/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ func New() venom.Executor {
return &Executor{}
}



type (
// Message represents the object sended or received from kafka
// Message represents the object sended or received from kafka
Message struct {
Topic string `json:"topic" yaml:"topic"`
Key string `json:"key" yaml:"key"`
Expand Down Expand Up @@ -94,7 +92,6 @@ type (
// Result represents a step result.
Result struct {
TimeSeconds float64 `json:"timeSeconds,omitempty" yaml:"timeSeconds,omitempty"`
TimeHuman string `json:"timeHuman,omitempty" yaml:"timeHuman,omitempty"`
Messages []Message `json:"messages,omitempty" yaml:"messages,omitempty"`
MessagesJSON []interface{} `json:"messagesJSON,omitempty" yaml:"messagesJSON,omitempty"`
Err string `json:"error" yaml:"error"`
Expand Down Expand Up @@ -150,7 +147,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down
3 changes: 1 addition & 2 deletions executors/ovhapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ testcases:
```
result.executor
result.timeseconds
result.timehuman
result.statuscode
result.body
result.bodyjson
result.error
```
- result.timeseconds & result.timehuman: time of execution
- result.timeseconds: execution duration
- result.err: if exists, this field contains error
- result.body: body of HTTP response
- result.bodyjson: body of HTTP response if it's a json. You can access json data as result.bodyjson.yourkey for example
Expand Down
2 changes: 0 additions & 2 deletions executors/ovhapi/ovhapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type Executor struct {
// Result represents a step result. Json and yaml descriptor are used for json output
type Result struct {
TimeSeconds float64 `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
TimeHuman string `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
StatusCode int `json:"statuscode,omitempty" yaml:"statuscode,omitempty"`
Body string `json:"body,omitempty" yaml:"body,omitempty"`
BodyJSON interface{} `json:"bodyjson,omitempty" yaml:"bodyjson,omitempty"`
Expand Down Expand Up @@ -148,7 +147,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
r.TimeSeconds = elapsed.Seconds()
r.TimeHuman = elapsed.String()

// Add response to result body
if res != nil {
Expand Down
2 changes: 0 additions & 2 deletions executors/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ type Executor struct {
// Result represents a step result.
type Result struct {
TimeSeconds float64 `json:"timeSeconds" yaml:"timeSeconds"`
TimeHuman string `json:"timeHuman" yaml:"timeHuman"`
Body []string `json:"body" yaml:"body"`
Messages []interface{} `json:"messages" yaml:"messages"`
BodyJSON []interface{} `json:"bodyJSON" yaml:"bodyJSON"`
Expand Down Expand Up @@ -122,7 +121,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down
5 changes: 1 addition & 4 deletions executors/readfile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ testcases:
```yaml
result.timeseconds
result.timehuman
result.executor.executor.path
result.content
result.contentjson
result.size.filename
Expand All @@ -42,8 +40,7 @@ testcases:
result.mod.filename
```

- result.timeseconds & result.timehuman: time for read file
- result.executor.path: executor condition with file path
- result.timeseconds: execution duration
- result.err: if exist, this field contains error
- result.content: content of readed file
- result.contentjson: content of readed file if it's a json. You can access json data as result.contentjson.yourkey for example
Expand Down
2 changes: 0 additions & 2 deletions executors/readfile/readfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type Result struct {
ContentJSON interface{} `json:"contentjson,omitempty" yaml:"contentjson,omitempty"`
Err string `json:"error" yaml:"error"`
TimeSeconds float64 `json:"timeSeconds,omitempty" yaml:"timeSeconds,omitempty"`
TimeHuman string `json:"timeHuman,omitempty" yaml:"timeHuman,omitempty"`
Md5sum map[string]string `json:"md5sum,omitempty" yaml:"md5sum,omitempty"`
Size map[string]int64 `json:"size,omitempty" yaml:"size,omitempty"`
ModTime map[string]int64 `json:"modtime,omitempty" yaml:"modtime,omitempty"`
Expand Down Expand Up @@ -80,7 +79,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down
2 changes: 0 additions & 2 deletions executors/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type Executor struct {
type Result struct {
Err string `json:"error,omitempty" yaml:"error"`
TimeSeconds float64 `json:"timeSeconds,omitempty" yaml:"timeSeconds,omitempty"`
TimeHuman string `json:"timeHuman,omitempty" yaml:"timeHuman,omitempty"`
}

// ZeroValueResult return an empty implemtation of this executor result
Expand Down Expand Up @@ -70,7 +69,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down
5 changes: 1 addition & 4 deletions executors/ssh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ testcases:
## Output

```yaml
executor
systemout
systemerr
err
code
timeseconds
timehuman
```

- result.timeseconds & result.timehuman: time of execution
- result.executor.executor.script: script executed
- result.timeseconds: time of execution
- result.err: if exists, this field contains error
- result.systemout: Standard Output of executed script
- result.systemerr: Error Output of executed script
Expand Down
2 changes: 0 additions & 2 deletions executors/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type Result struct {
Err string `json:"err,omitempty" yaml:"err,omitempty"`
Code string `json:"code,omitempty" yaml:"code,omitempty"`
TimeSeconds float64 `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
TimeHuman string `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
}

// ZeroValueResult return an empty implemtation of this executor result
Expand Down Expand Up @@ -100,7 +99,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down
1 change: 0 additions & 1 deletion executors/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ testcases:
* result.url
* result.timeseconds
* result.timehuman
* result.title
* result.find
Expand Down
2 changes: 0 additions & 2 deletions executors/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type Result struct {
Find int `json:"find,omitempty" yaml:"find,omitempty"`
HTML string `json:"html,omitempty" yaml:"html,omitempty"`
TimeSeconds float64 `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
TimeHuman string `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Text string `json:"text,omitempty" yaml:"text,omitempty"`
Expand Down Expand Up @@ -177,7 +176,6 @@ func (Executor) Run(ctx context.Context, step venom.TestStep, workdir string) (i

elapsed := time.Since(start)
result.TimeSeconds = elapsed.Seconds()
result.TimeHuman = elapsed.String()

return result, nil
}
Expand Down

0 comments on commit 410851d

Please sign in to comment.