Skip to content

Commit

Permalink
fix: fail fast may cause Serial spec or cleanup Node interrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvz committed Apr 4, 2023
1 parent 227c662 commit 2a8be0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/interrupt_handler/interrupt_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ type InterruptStatus struct {
Cause InterruptCause
}

func (s InterruptStatus) BlockForUpdate() {
<-time.After(ABORT_POLLING_INTERVAL)
}

func (s InterruptStatus) Interrupted() bool {
return s.Level != InterruptLevelUninterrupted
}
Expand Down
7 changes: 7 additions & 0 deletions internal/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ func (suite *Suite) runSpecs(description string, suiteLabels Labels, suitePath s
if suite.config.ParallelProcess == 1 && len(serialGroupedSpecIndices) > 0 {
groupedSpecIndices, serialGroupedSpecIndices, nextIndex = serialGroupedSpecIndices, GroupedSpecIndices{}, MakeIncrementingIndexCounter()
suite.client.BlockUntilNonprimaryProcsHaveFinished()
suite.interruptHandler.Status().BlockForUpdate()
continue
}
break
Expand Down Expand Up @@ -937,6 +938,12 @@ func (suite *Suite) runNode(node Node, specDeadline time.Time, text string) (typ
gracePeriodChannel = time.After(gracePeriod)
case <-interruptStatus.Channel:
interruptStatus = suite.interruptHandler.Status()
// ignored interruption from other process if we are cleaning up or reporting
if interruptStatus.Cause == interrupt_handler.InterruptCauseAbortByOtherProcess &&
node.NodeType.Is(types.NodeTypesAllowedDuringReportInterrupt|types.NodeTypesAllowedDuringCleanupInterrupt) {
continue
}

deadlineChannel = nil // don't worry about deadlines, time's up now

failureTimelineLocation := suite.generateTimelineLocation()
Expand Down

0 comments on commit 2a8be0e

Please sign in to comment.