Skip to content
Merged
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
26 changes: 13 additions & 13 deletions internal/testrunner/runners/system/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ func (r *runner) runTest(config *testConfig, ctxt servicedeployer.ServiceContext
logger.Debug("checking for expected data in data stream...")
var hits *hits
oldHits := 0
passed, err := waitUntilTrue(func() (bool, error) {
passed, waitErr := waitUntilTrue(func() (bool, error) {
if signal.SIGINT() {
return true, errors.New("SIGINT: cancel waiting for policy assigned")
}
Expand All @@ -662,8 +662,18 @@ func (r *runner) runTest(config *testConfig, ctxt servicedeployer.ServiceContext
return hits.size() > 0, err
}, waitForDataTimeout)

if err != nil {
return result.WithError(err)
if config.Service != "" && !config.IgnoreServiceError {
exited, code, err := service.ExitCode(config.Service)
if err != nil && !errors.Is(err, servicedeployer.ErrNotSupported) {
return result.WithError(err)
}
if exited && code > 0 {
return result.WithError(testrunner.ErrTestCaseFailed{Reason: fmt.Sprintf("the test service %s unexpectedly exited with code %d", config.Service, code)})
}
}

if waitErr != nil {
return result.WithError(waitErr)
}

if !passed {
Expand Down Expand Up @@ -753,16 +763,6 @@ func (r *runner) runTest(config *testConfig, ctxt servicedeployer.ServiceContext
return result.WithError(err)
}

if config.Service != "" && !config.IgnoreServiceError {
exited, code, err := service.ExitCode(config.Service)
if err != nil && !errors.Is(err, servicedeployer.ErrNotSupported) {
return result.WithError(err)
}
if exited && code > 0 {
result.FailureMsg = fmt.Sprintf("the test service %s unexpectedly exited with code %d", config.Service, code)
}
}

return result.WithSuccess()
}

Expand Down