Skip to content

Commit

Permalink
add option to get cli run time duration in test
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Dec 6, 2021
1 parent 90e7205 commit eb6e7d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kit/clitest/clitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ func (e *Env) Run(name string, arg ...string) *Expect {
stdout: fileContent(e.stdoutFilename),
stderr: fileContent(e.stderrFilename),
exitCode: exitCode(runError),
duration: dur,
}
ex.Stdout()
return ex
Expand Down Expand Up @@ -295,6 +296,7 @@ type Expect struct {
exitCode int
out string
outType string
duration time.Duration
}

func (e *Expect) Success() *Expect {
Expand Down Expand Up @@ -378,3 +380,7 @@ func (e *Env) WithWorkdir(cb func()) {
os.Chdir(cwd)
}
}

func (e *Expect) Duration() time.Duration {
return e.duration
}

0 comments on commit eb6e7d4

Please sign in to comment.