Skip to content

Commit

Permalink
fix: test suite event end time
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Jul 18, 2024
1 parent 5d86913 commit 4be3a91
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/event/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (e *Emitter) stopListener(name string) {
if err != nil {
e.Log.Errorw("error while stopping listener", "error", err)
}
e.Log.Infow("stopped listener", name)
e.Log.Info("stopped listener", name)
}

func (e *Emitter) notifyHandler(l common.Listener) bus.Handler {
Expand All @@ -194,7 +194,7 @@ func (e *Emitter) Reconcile(ctx context.Context) {
for {
select {
case <-ctx.Done():
e.Log.Infow("stopping reconciler")
e.Log.Info("stopping reconciler")
return
default:
listeners := e.Loader.Reconcile()
Expand Down
17 changes: 13 additions & 4 deletions pkg/scheduler/testsuite_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,14 @@ func (s *Scheduler) runSteps(ctx context.Context, wg *sync.WaitGroup, testsuiteE

if testsuiteExecution.Status != nil && *testsuiteExecution.Status == testkube.ABORTING_TestSuiteExecutionStatus {
if abortionStatus != nil && *abortionStatus == testkube.TIMEOUT_TestSuiteExecutionStatus {
s.events.Notify(testkube.NewEventEndTestSuiteTimeout(testsuiteExecution))
testsuiteExecution.Status = testkube.TestSuiteExecutionStatusTimeout
} else {
s.events.Notify(testkube.NewEventEndTestSuiteAborted(testsuiteExecution))
testsuiteExecution.Status = testkube.TestSuiteExecutionStatusAborted
}
} else if hasFailedSteps {
testsuiteExecution.Status = testkube.TestSuiteExecutionStatusFailed
s.events.Notify(testkube.NewEventEndTestSuiteFailed(testsuiteExecution))
} else {
testsuiteExecution.Status = testkube.TestSuiteExecutionStatusPassed
s.events.Notify(testkube.NewEventEndTestSuiteSuccess(testsuiteExecution))
}

s.metrics.IncAndObserveExecuteTestSuite(*testsuiteExecution, s.dashboardURI)
Expand All @@ -281,6 +277,19 @@ func (s *Scheduler) runAfterEachStep(ctx context.Context, execution *testkube.Te

wg.Done()

if execution.Status != nil {
switch *execution.Status {
case *testkube.TestSuiteExecutionStatusTimeout:
s.events.Notify(testkube.NewEventEndTestSuiteTimeout(execution))
case *testkube.TestSuiteExecutionStatusAborted:
s.events.Notify(testkube.NewEventEndTestSuiteAborted(execution))
case *testkube.TestSuiteExecutionStatusFailed:
s.events.Notify(testkube.NewEventEndTestSuiteFailed(execution))
case *testkube.TestSuiteExecutionStatusPassed:
s.events.Notify(testkube.NewEventEndTestSuiteSuccess(execution))
}
}

if execution.TestSuite != nil {
testSuite, err := s.testSuitesClient.Get(execution.TestSuite.Name)
if err != nil {
Expand Down

0 comments on commit 4be3a91

Please sign in to comment.