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
4 changes: 2 additions & 2 deletions qa-plugin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.0 // indirect
github.com/go-git/go-git/v5 v5.13.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
golang.org/x/crypto v0.35.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/net v0.36.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/term v0.29.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions qa-plugin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ github.com/go-git/go-git/v5 v5.13.0 h1:vLn5wlGIh/X78El6r3Jr+30W16Blk0CTcxTYcYPWi
github.com/go-git/go-git/v5 v5.13.0/go.mod h1:Wjo7/JyVKtQgUNdXYXIepzWfJQkUEIGvkvVkiXRR/zw=
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
Expand Down Expand Up @@ -235,6 +236,7 @@ golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
Expand Down
2 changes: 1 addition & 1 deletion test/commands/show_execution_history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestShowExecutionHistory(t *testing.T) {

for _, tt := range tests {
it.Run(tt.name, func(t *infra.Test) {
it.ResetOutput()
it.ResetIO()
tt.test(t, workerKey)
})
}
Expand Down
26 changes: 17 additions & 9 deletions test/infra/itest_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ type Test struct {
AccessToken string
dataDir string
platformUrl string
output *bytes.Buffer
input string
stdout *bytes.Buffer
stdin *bytes.Reader
t *testing.T
}

Expand Down Expand Up @@ -124,10 +126,12 @@ func runTest(t *testing.T, testSpec TestDefinition) {
AccessToken: accessToken,
dataDir: homeDir,
platformUrl: platformUrl,
input: testSpec.Input,
}

if testSpec.Input != "" {
common.SetCliIn(bytes.NewReader([]byte(testSpec.Input)))
it.stdin = bytes.NewReader([]byte(testSpec.Input))
common.SetCliIn(it.stdin)
t.Cleanup(func() {
common.SetCliIn(os.Stdin)
})
Expand All @@ -139,7 +143,7 @@ func runTest(t *testing.T, testSpec TestDefinition) {
t.Cleanup(func() {
common.SetCliOut(os.Stdout)
})
it.output = &newOutput
it.stdout = &newOutput
}

testSpec.Test(it)
Expand Down Expand Up @@ -187,6 +191,7 @@ func (it *Test) RetryCommand(args []string, backoff time.Duration, timeout time.

for shouldRetryCommandOnError(err, onErrorContaining) && elapsed < timeout {
time.Sleep(waitDuration)
it.ResetIO()
err = runPlugin()
elapsed = time.Since(start)
}
Expand All @@ -209,8 +214,8 @@ func shouldRetryCommandOnError(err error, onErrorContaining []string) bool {
}

func (it *Test) CapturedOutput() []byte {
if it.output != nil {
return it.output.Bytes()
if it.stdout != nil {
return it.stdout.Bytes()
}
return nil
}
Expand Down Expand Up @@ -271,9 +276,12 @@ func (it *Test) DeleteWorker(workerKey string) {
}
}

func (it *Test) ResetOutput() {
if it.output != nil {
it.output.Reset()
func (it *Test) ResetIO() {
if it.stdin != nil {
it.stdin.Reset([]byte(it.input))
}
if it.stdout != nil {
it.stdout.Reset()
}
}

Expand Down Expand Up @@ -347,7 +355,7 @@ func (it *Test) Helper() {

func (it *Test) Run(name string, f func(t *Test)) bool {
return it.t.Run(name, func(t *testing.T) {
f(&Test{t: t, ServerId: it.ServerId, AccessToken: it.AccessToken, dataDir: it.dataDir, output: it.output})
f(&Test{t: t, ServerId: it.ServerId, AccessToken: it.AccessToken, dataDir: it.dataDir, stdout: it.stdout, stdin: it.stdin, input: it.input})
})
}

Expand Down
Loading