|
| 1 | +// The MIT License |
| 2 | +// |
| 3 | +// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. |
| 4 | +// |
| 5 | +// Copyright (c) 2020 Uber Technologies, Inc. |
| 6 | +// |
| 7 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +// of this software and associated documentation files (the "Software"), to deal |
| 9 | +// in the Software without restriction, including without limitation the rights |
| 10 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +// copies of the Software, and to permit persons to whom the Software is |
| 12 | +// furnished to do so, subject to the following conditions: |
| 13 | +// |
| 14 | +// The above copyright notice and this permission notice shall be included in |
| 15 | +// all copies or substantial portions of the Software. |
| 16 | +// |
| 17 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 23 | +// THE SOFTWARE. |
| 24 | + |
| 25 | +package testcore |
| 26 | + |
| 27 | +import ( |
| 28 | + "time" |
| 29 | + |
| 30 | + "go.temporal.io/server/common/dynamicconfig" |
| 31 | + "go.temporal.io/server/common/persistence/visibility" |
| 32 | +) |
| 33 | + |
| 34 | +var ( |
| 35 | + // Functional tests don't use dynamic config files. All settings get their default values |
| 36 | + // defined in common/dynamicconfig/constants.go. |
| 37 | + // |
| 38 | + // There are 4 ways to override a setting: |
| 39 | + // 1. Globally using this file. Every test suite creates a new test cluster using this overrides. |
| 40 | + // 2. Per test suite using FunctionalTestBase.SetupSuiteWithCluster() and WithDynamicConfigOverrides() option. |
| 41 | + // 3. Per test using FunctionalTestBase.OverrideDynamicConfig() method. |
| 42 | + // 4. Per specific cluster per test (if test has more than one cluster) using TestCluster.OverrideDynamicConfig() method. |
| 43 | + // |
| 44 | + // NOTE1: settings which are not really dynamic (requires server restart to take effect) can't be overridden on test level, |
| 45 | + // i.e., must be overridden globally (1) or per test suite (2). |
| 46 | + // NOTE2: per test overrides change the value for the cluster, therefore, it affects not only a specific test, but |
| 47 | + // all tests for that suite. The automatic cleanup reverts to the previous value and tests don't affect each other. |
| 48 | + // But that means tests in the same suite can't be run in parallel. This is not a problem because testify |
| 49 | + // doesn't allow parallel execution of tests in the same suite anyway. If one day, it will be allowed, |
| 50 | + // unique namespaces with overrides per namespace should be used for tests that require overrides. |
| 51 | + dynamicConfigOverrides = map[dynamicconfig.Key]any{ |
| 52 | + dynamicconfig.FrontendRPS.Key(): 3000, |
| 53 | + dynamicconfig.FrontendMaxNamespaceVisibilityRPSPerInstance.Key(): 50, |
| 54 | + dynamicconfig.FrontendMaxNamespaceVisibilityBurstRatioPerInstance.Key(): 1, |
| 55 | + dynamicconfig.ReplicationTaskProcessorErrorRetryMaxAttempts.Key(): 1, |
| 56 | + dynamicconfig.SecondaryVisibilityWritingMode.Key(): visibility.SecondaryVisibilityWritingModeOff, |
| 57 | + dynamicconfig.WorkflowTaskHeartbeatTimeout.Key(): 5 * time.Second, |
| 58 | + dynamicconfig.ReplicationTaskFetcherAggregationInterval.Key(): 200 * time.Millisecond, |
| 59 | + dynamicconfig.ReplicationTaskFetcherErrorRetryWait.Key(): 50 * time.Millisecond, |
| 60 | + dynamicconfig.ReplicationTaskProcessorErrorRetryWait.Key(): time.Millisecond, |
| 61 | + dynamicconfig.ClusterMetadataRefreshInterval.Key(): 100 * time.Millisecond, |
| 62 | + dynamicconfig.NamespaceCacheRefreshInterval.Key(): NamespaceCacheRefreshInterval, |
| 63 | + dynamicconfig.ReplicationEnableUpdateWithNewTaskMerge.Key(): true, |
| 64 | + dynamicconfig.ValidateUTF8SampleRPCRequest.Key(): 1.0, |
| 65 | + dynamicconfig.ValidateUTF8SampleRPCResponse.Key(): 1.0, |
| 66 | + dynamicconfig.ValidateUTF8SamplePersistence.Key(): 1.0, |
| 67 | + dynamicconfig.ValidateUTF8FailRPCRequest.Key(): true, |
| 68 | + dynamicconfig.ValidateUTF8FailRPCResponse.Key(): true, |
| 69 | + dynamicconfig.ValidateUTF8FailPersistence.Key(): true, |
| 70 | + dynamicconfig.EnableWorkflowExecutionTimeoutTimer.Key(): true, |
| 71 | + dynamicconfig.FrontendMaskInternalErrorDetails.Key(): false, |
| 72 | + dynamicconfig.HistoryScannerEnabled.Key(): false, |
| 73 | + dynamicconfig.TaskQueueScannerEnabled.Key(): false, |
| 74 | + dynamicconfig.ExecutionsScannerEnabled.Key(): false, |
| 75 | + dynamicconfig.BuildIdScavengerEnabled.Key(): false, |
| 76 | + |
| 77 | + // Better to read through in tests than add artificial sleeps (which is what we previously had). |
| 78 | + dynamicconfig.ForceSearchAttributesCacheRefreshOnRead.Key(): true, |
| 79 | + |
| 80 | + dynamicconfig.RetentionTimerJitterDuration.Key(): time.Second, |
| 81 | + dynamicconfig.EnableEagerWorkflowStart.Key(): true, |
| 82 | + dynamicconfig.FrontendEnableExecuteMultiOperation.Key(): true, |
| 83 | + dynamicconfig.ActivityAPIsEnabled.Key(): true, |
| 84 | + } |
| 85 | +) |
0 commit comments