mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
Use shorter timeouts in tests known to not yield (#9308)
## What changed? WISOTT ## Why? A few tests have issues not yielding in the allotted 40 minute test time, causing timeouts and CI failures. This addresses two of those. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks NA, tests only
This commit is contained in:
@@ -1887,7 +1887,7 @@ func (s *VersioningIntegSuite) dispatchActivity(failMode activityFailMode, newVe
|
||||
panic("workflow should not run on v2")
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if newVersioning {
|
||||
@@ -1977,7 +1977,7 @@ func (s *VersioningIntegSuite) TestDispatchActivityUpgrade() {
|
||||
v11 := s.prefixed("v1.1")
|
||||
v12 := s.prefixed("v1.2")
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
startedWf := make(chan struct{}, 1)
|
||||
|
||||
+18
-1
@@ -1216,6 +1216,9 @@ func (s *WorkflowTestSuite) TestCompleteWorkflowTaskAndCreateNewOne() {
|
||||
}
|
||||
|
||||
func (s *WorkflowTestSuite) TestWorkflowTaskAndActivityTaskTimeoutsWorkflow() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
||||
defer cancel()
|
||||
|
||||
tv := testvars.New(s.T())
|
||||
request := &workflowservice.StartWorkflowExecutionRequest{
|
||||
RequestId: uuid.NewString(),
|
||||
@@ -1229,7 +1232,7 @@ func (s *WorkflowTestSuite) TestWorkflowTaskAndActivityTaskTimeoutsWorkflow() {
|
||||
Identity: tv.WorkerIdentity(),
|
||||
}
|
||||
|
||||
we, err0 := s.FrontendClient().StartWorkflowExecution(testcore.NewContext(), request)
|
||||
we, err0 := s.FrontendClient().StartWorkflowExecution(ctx, request)
|
||||
s.NoError(err0)
|
||||
|
||||
s.Logger.Info("StartWorkflowExecution", tag.WorkflowRunID(we.RunId))
|
||||
@@ -1295,6 +1298,13 @@ func (s *WorkflowTestSuite) TestWorkflowTaskAndActivityTaskTimeoutsWorkflow() {
|
||||
testStart := time.Now()
|
||||
var lastDropTime time.Time
|
||||
for i := 0; i < 8; i++ {
|
||||
// Check if test context has been cancelled/timed out
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
s.FailNow("Test timeout exceeded", "context deadline exceeded after %v", time.Since(testStart))
|
||||
default:
|
||||
}
|
||||
|
||||
iterStart := time.Now()
|
||||
dropWorkflowTask := (i%2 == 0)
|
||||
s.Logger.Info(testTag+"iteration starting",
|
||||
@@ -1338,6 +1348,13 @@ func (s *WorkflowTestSuite) TestWorkflowTaskAndActivityTaskTimeoutsWorkflow() {
|
||||
|
||||
s.Logger.Info(testTag+"waiting for workflow to complete", tag.WorkflowRunID(we.RunId))
|
||||
|
||||
// Check if test context has been cancelled/timed out before final poll
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
s.FailNow("Test timeout exceeded", "context deadline exceeded after %v", time.Since(testStart))
|
||||
default:
|
||||
}
|
||||
|
||||
s.False(workflowComplete)
|
||||
_, err := poller.PollAndProcessWorkflowTask(testcore.WithDumpHistory)
|
||||
s.NoError(err)
|
||||
|
||||
Reference in New Issue
Block a user