Skip to content

Commit 4576a10

Browse files
authored
Add debug.TimeoutMultiplier to all timeouts (#3815)
1 parent a54483d commit 4576a10

19 files changed

+42
-22
lines changed

common/persistence/cassandra/test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131

3232
"go.temporal.io/server/common"
3333
"go.temporal.io/server/common/config"
34+
"go.temporal.io/server/common/debug"
3435
"go.temporal.io/server/common/dynamicconfig"
3536
"go.temporal.io/server/common/log"
3637
"go.temporal.io/server/common/log/tag"
@@ -76,7 +77,7 @@ func NewTestCluster(keyspace, username, password, host string, port int, schemaD
7677
Hosts: host,
7778
Port: port,
7879
MaxConns: 2,
79-
ConnectTimeout: 30 * time.Second,
80+
ConnectTimeout: 30 * time.Second * debug.TimeoutMultiplier,
8081
Keyspace: keyspace,
8182
}
8283
result.faultInjection = faultInjection

common/persistence/nosql/nosqlplugin/cassandra/gocql/client.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838

3939
"go.temporal.io/server/common/auth"
4040
"go.temporal.io/server/common/config"
41+
"go.temporal.io/server/common/debug"
4142
"go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator"
4243
"go.temporal.io/server/common/resolver"
4344
)
@@ -143,8 +144,8 @@ func NewCassandraCluster(
143144
cluster.Timeout = cfg.ConnectTimeout
144145
cluster.ConnectTimeout = cfg.ConnectTimeout
145146
} else {
146-
cluster.Timeout = 10 * time.Second
147-
cluster.ConnectTimeout = 10 * time.Second
147+
cluster.Timeout = 10 * time.Second * debug.TimeoutMultiplier
148+
cluster.ConnectTimeout = 10 * time.Second * debug.TimeoutMultiplier
148149
}
149150

150151
cluster.ProtoVersion = 4

common/persistence/persistence-tests/clusterMetadataManagerTest.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
versionpb "go.temporal.io/api/version/v1"
3636

3737
persistencespb "go.temporal.io/server/api/persistence/v1"
38+
"go.temporal.io/server/common/debug"
3839
p "go.temporal.io/server/common/persistence"
3940
"go.temporal.io/server/common/primitives"
4041
)
@@ -60,7 +61,7 @@ func (s *ClusterMetadataManagerSuite) SetupSuite() {
6061
func (s *ClusterMetadataManagerSuite) SetupTest() {
6162
// Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
6263
s.Assertions = require.New(s.T())
63-
s.ctx, s.cancel = context.WithTimeout(context.Background(), time.Second*30)
64+
s.ctx, s.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
6465
}
6566

6667
// TearDownTest implementation

common/persistence/persistence-tests/historyV2PersistenceTest.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
historypb "go.temporal.io/api/history/v1"
3939
"go.temporal.io/api/serviceerror"
4040

41+
"go.temporal.io/server/common/debug"
4142
"go.temporal.io/server/common/persistence/serialization"
4243

4344
persistencespb "go.temporal.io/server/api/persistence/v1"
@@ -91,7 +92,7 @@ func (s *HistoryV2PersistenceSuite) SetupTest() {
9192
// Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
9293
s.Assertions = require.New(s.T())
9394

94-
s.ctx, s.cancel = context.WithTimeout(context.Background(), time.Second*30)
95+
s.ctx, s.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
9596
}
9697

9798
// TearDownTest implementation

common/persistence/persistence-tests/metadataPersistenceV2Test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242

4343
persistencespb "go.temporal.io/server/api/persistence/v1"
4444
"go.temporal.io/server/common/cluster"
45+
"go.temporal.io/server/common/debug"
4546
p "go.temporal.io/server/common/persistence"
4647
"go.temporal.io/server/common/primitives/timestamp"
4748
)
@@ -67,7 +68,7 @@ func (m *MetadataPersistenceSuiteV2) SetupSuite() {
6768
func (m *MetadataPersistenceSuiteV2) SetupTest() {
6869
// Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
6970
m.Assertions = require.New(m.T())
70-
m.ctx, m.cancel = context.WithTimeout(context.Background(), time.Second*30)
71+
m.ctx, m.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
7172

7273
// cleanup the namespace created
7374
var token []byte

common/persistence/persistence-tests/queuePersistenceTest.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434

3535
enumsspb "go.temporal.io/server/api/enums/v1"
3636
replicationspb "go.temporal.io/server/api/replication/v1"
37+
"go.temporal.io/server/common/debug"
3738
"go.temporal.io/server/common/persistence"
3839
)
3940

@@ -58,7 +59,7 @@ func (s *QueuePersistenceSuite) SetupSuite() {
5859
func (s *QueuePersistenceSuite) SetupTest() {
5960
// Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
6061
s.Assertions = require.New(s.T())
61-
s.ctx, s.cancel = context.WithTimeout(context.Background(), time.Second*30)
62+
s.ctx, s.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
6263
}
6364

6465
func (s *QueuePersistenceSuite) TearDownTest() {

common/persistence/sql/sqlplugin/tests/context.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ package tests
2727
import (
2828
"context"
2929
"time"
30+
31+
"go.temporal.io/server/common/debug"
3032
)
3133

3234
const (
33-
executionTimeout = 2 * time.Second
34-
visibilityTimeout = 4 * time.Second
35+
executionTimeout = 2 * time.Second * debug.TimeoutMultiplier
36+
visibilityTimeout = 4 * time.Second * debug.TimeoutMultiplier
3537
)
3638

3739
func newExecutionContext() context.Context {

common/persistence/tests/execution_mutable_state.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
enumsspb "go.temporal.io/server/api/enums/v1"
4242
persistencespb "go.temporal.io/server/api/persistence/v1"
4343
"go.temporal.io/server/common/convert"
44+
"go.temporal.io/server/common/debug"
4445
"go.temporal.io/server/common/dynamicconfig"
4546
"go.temporal.io/server/common/log"
4647
p "go.temporal.io/server/common/persistence"
@@ -100,7 +101,7 @@ func (s *ExecutionMutableStateSuite) TearDownSuite() {
100101

101102
func (s *ExecutionMutableStateSuite) SetupTest() {
102103
s.Assertions = require.New(s.T())
103-
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), time.Second*30)
104+
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
104105

105106
s.ShardID++
106107
resp, err := s.ShardManager.GetOrCreateShard(s.Ctx, &p.GetOrCreateShardRequest{

common/persistence/tests/execution_mutable_state_task.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"go.temporal.io/api/serviceerror"
4141

4242
persistencespb "go.temporal.io/server/api/persistence/v1"
43+
"go.temporal.io/server/common/debug"
4344
"go.temporal.io/server/common/definition"
4445
"go.temporal.io/server/common/dynamicconfig"
4546
"go.temporal.io/server/common/log"
@@ -102,7 +103,7 @@ func NewExecutionMutableStateTaskSuite(
102103

103104
func (s *ExecutionMutableStateTaskSuite) SetupTest() {
104105
s.Assertions = require.New(s.T())
105-
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), time.Second*30)
106+
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
106107

107108
s.ShardID++
108109
resp, err := s.ShardManager.GetOrCreateShard(s.Ctx, &p.GetOrCreateShardRequest{

common/persistence/tests/history_store.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939

4040
persistencespb "go.temporal.io/server/api/persistence/v1"
4141
"go.temporal.io/server/common"
42+
"go.temporal.io/server/common/debug"
4243
"go.temporal.io/server/common/dynamicconfig"
4344
"go.temporal.io/server/common/log"
4445
p "go.temporal.io/server/common/persistence"
@@ -101,7 +102,7 @@ func (s *HistoryEventsSuite) TearDownSuite() {
101102

102103
func (s *HistoryEventsSuite) SetupTest() {
103104
s.Assertions = require.New(s.T())
104-
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), time.Second*30)
105+
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
105106
}
106107

107108
func (s *HistoryEventsSuite) TearDownTest() {

common/persistence/tests/shard.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/stretchr/testify/require"
3434
"github.com/stretchr/testify/suite"
3535

36+
"go.temporal.io/server/common/debug"
3637
"go.temporal.io/server/common/log"
3738
p "go.temporal.io/server/common/persistence"
3839
"go.temporal.io/server/common/persistence/serialization"
@@ -79,7 +80,7 @@ func (s *ShardSuite) TearDownSuite() {
7980

8081
func (s *ShardSuite) SetupTest() {
8182
s.Assertions = require.New(s.T())
82-
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), time.Second*30)
83+
s.Ctx, s.Cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
8384

8485
s.ShardID++
8586
}

common/persistence/tests/task_queue.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
"go.temporal.io/api/serviceerror"
3838

3939
persistencespb "go.temporal.io/server/api/persistence/v1"
40+
"go.temporal.io/server/common/debug"
4041
"go.temporal.io/server/common/log"
4142
p "go.temporal.io/server/common/persistence"
4243
"go.temporal.io/server/common/persistence/serialization"
@@ -86,7 +87,7 @@ func (s *TaskQueueSuite) TearDownSuite() {
8687

8788
func (s *TaskQueueSuite) SetupTest() {
8889
s.Assertions = require.New(s.T())
89-
s.ctx, s.cancel = context.WithTimeout(context.Background(), time.Second*30)
90+
s.ctx, s.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
9091

9192
s.stickyTTL = time.Second * 10
9293
s.namespaceID = uuid.New().String()

common/persistence/tests/task_queue_task.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737

3838
clockspb "go.temporal.io/server/api/clock/v1"
3939
persistencespb "go.temporal.io/server/api/persistence/v1"
40+
"go.temporal.io/server/common/debug"
4041

4142
"go.temporal.io/server/common/log"
4243
p "go.temporal.io/server/common/persistence"
@@ -88,7 +89,7 @@ func (s *TaskQueueTaskSuite) TearDownSuite() {
8889

8990
func (s *TaskQueueTaskSuite) SetupTest() {
9091
s.Assertions = require.New(s.T())
91-
s.ctx, s.cancel = context.WithTimeout(context.Background(), time.Second*30)
92+
s.ctx, s.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
9293

9394
s.stickyTTL = time.Second * 10
9495
s.taskTTL = time.Second * 16

common/persistence/tests/visibility_persistence_suite_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
enumspb "go.temporal.io/api/enums/v1"
3636
workflowpb "go.temporal.io/api/workflow/v1"
3737

38+
"go.temporal.io/server/common/debug"
3839
"go.temporal.io/server/common/dynamicconfig"
3940
"go.temporal.io/server/common/log/tag"
4041
"go.temporal.io/server/common/metrics"
@@ -88,7 +89,7 @@ func (s *VisibilityPersistenceSuite) SetupSuite() {
8889
func (s *VisibilityPersistenceSuite) SetupTest() {
8990
// Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
9091
s.Assertions = require.New(s.T())
91-
s.ctx, s.cancel = context.WithTimeout(context.Background(), time.Second*30)
92+
s.ctx, s.cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
9293
}
9394

9495
func (s *VisibilityPersistenceSuite) TearDownTest() {

common/persistence/visibility/store/elasticsearch/visibility_store_read_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
enumspb "go.temporal.io/api/enums/v1"
4343
"go.temporal.io/api/serviceerror"
4444

45+
"go.temporal.io/server/common/debug"
4546
"go.temporal.io/server/common/dynamicconfig"
4647
"go.temporal.io/server/common/metrics"
4748
"go.temporal.io/server/common/namespace"
@@ -117,7 +118,7 @@ func (s *ESVisibilitySuite) SetupTest() {
117118
// Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
118119
s.Assertions = require.New(s.T())
119120

120-
esProcessorAckTimeout := dynamicconfig.GetDurationPropertyFn(1 * time.Minute)
121+
esProcessorAckTimeout := dynamicconfig.GetDurationPropertyFn(1 * time.Minute * debug.TimeoutMultiplier)
121122
visibilityDisableOrderByClause := dynamicconfig.GetBoolPropertyFn(false)
122123

123124
s.controller = gomock.NewController(s.T())

service/history/queues/queue_base.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"go.temporal.io/server/common"
3434
"go.temporal.io/server/common/backoff"
3535
"go.temporal.io/server/common/clock"
36+
"go.temporal.io/server/common/debug"
3637
"go.temporal.io/server/common/dynamicconfig"
3738
"go.temporal.io/server/common/headers"
3839
"go.temporal.io/server/common/log"
@@ -53,7 +54,7 @@ const (
5354
// task alert & action
5455
nonDefaultReaderMaxPendingTaskCoefficient = 0.8
5556

56-
queueIOTimeout = 5 * time.Second
57+
queueIOTimeout = 5 * time.Second * debug.TimeoutMultiplier
5758

5859
// Force creating new slice every forceNewSliceDuration
5960
// so that the last slice in the default reader won't grow

service/history/shard/context_impl.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
cclock "go.temporal.io/server/common/clock"
5151
"go.temporal.io/server/common/cluster"
5252
"go.temporal.io/server/common/convert"
53+
"go.temporal.io/server/common/debug"
5354
"go.temporal.io/server/common/definition"
5455
"go.temporal.io/server/common/future"
5556
"go.temporal.io/server/common/headers"
@@ -82,7 +83,7 @@ const (
8283
)
8384

8485
const (
85-
shardIOTimeout = 5 * time.Second
86+
shardIOTimeout = 5 * time.Second * debug.TimeoutMultiplier
8687

8788
pendingMaxReplicationTaskID = math.MaxInt64
8889
)

service/history/transferQueueTaskExecutorBase.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"go.temporal.io/server/api/historyservice/v1"
3737
"go.temporal.io/server/api/matchingservice/v1"
3838
"go.temporal.io/server/common"
39+
"go.temporal.io/server/common/debug"
3940
"go.temporal.io/server/common/log"
4041
"go.temporal.io/server/common/log/tag"
4142
"go.temporal.io/server/common/metrics"
@@ -55,8 +56,8 @@ import (
5556
)
5657

5758
const (
58-
taskTimeout = time.Second * 3
59-
taskGetExecutionTimeout = time.Second
59+
taskTimeout = time.Second * 3 * debug.TimeoutMultiplier
60+
taskGetExecutionTimeout = time.Second * debug.TimeoutMultiplier
6061
taskHistoryOpTimeout = 20 * time.Second
6162
)
6263

service/matching/taskQueueManager.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import (
4747
"go.temporal.io/server/common/backoff"
4848
"go.temporal.io/server/common/clock"
4949
"go.temporal.io/server/common/cluster"
50+
"go.temporal.io/server/common/debug"
5051
"go.temporal.io/server/common/dynamicconfig"
5152
"go.temporal.io/server/common/future"
5253
"go.temporal.io/server/common/headers"
@@ -66,7 +67,7 @@ const (
6667
// Fake Task ID to wrap a task for syncmatch
6768
syncMatchTaskId = -137
6869

69-
ioTimeout = 5 * time.Second
70+
ioTimeout = 5 * time.Second * debug.TimeoutMultiplier
7071

7172
// Threshold for counting a AddTask call as a no recent poller call
7273
noPollerThreshold = time.Minute * 2

0 commit comments

Comments
 (0)