-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: arrange and document dynamic config usages in functional tests #7096
Conversation
@@ -140,16 +140,6 @@ type ( | |||
HistoryConfig struct { | |||
NumHistoryShards int32 | |||
NumHistoryHosts int | |||
|
|||
// TODO (alex): Remove all this limits and replace them with consts in sizelimit_tests.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
// Functional tests don't use dynamic config files. All settings get their default values | ||
// defined in common/dynamicconfig/constants.go. | ||
// There are 4 ways to override a setting: | ||
// 1. Globally using this file. Every test suite creates a new test cluster using this overrides. | ||
// 2. Per test suite using FunctionalTestBase.SetupSuiteWithCluster() and WithDynamicConfigOverrides() option. | ||
// 3. Per test using FunctionalTestBase.OverrideDynamicConfig() method. | ||
// 4. Per specific cluster per test (if test has more than one cluster) using TestCluster.OverrideDynamicConfig() method. | ||
// | ||
// NOTE1: settings which are not really dynamic (requires server restart to take effect) can't be overridden on test level, | ||
// i.e., must be overridden globally (1) or per test suite (2). | ||
// NOTE2: per test overrides change value for the cluster, therefore, it affects not only specific test, but | ||
// all tests for this suite. Automatic cleanup reverts previous value and tests don't affect each other. | ||
// But it means that tests in the same suite can be run in parallel.This is not a problem because testify | ||
// doesn't allow parallel execution of tests in the same suite anyway. If one day, it will be allowed, | ||
// unique namespaces with overrides per namespace should be used for tests which require different settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main idea of this PR: describe how to override DC and consolidate all global overrides in one file with clear name (for easy discovery).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Fix English. Co-authored-by: Stephan Behnke <stephanos@users.noreply.github.com>
Co-authored-by: Stephan Behnke <stephanos@users.noreply.github.com>
…sts (temporalio#7096) ## What changed? <!-- Describe what has changed in this PR --> - Consolidated all global DCs in one file with clear name for easy discovery. - Documented how to override DCs properly. - Cleaned up duplicated configs. ## Why? <!-- Tell your future self why have you made these changes --> Quality of life for function test writers. ## How did you test it? <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> Run. ## Potential risks <!-- Assuming the worst case, what can be broken when deploying this change to production? --> No risks. ## Documentation <!-- Have you made sure this change doesn't falsify anything currently stated in `docs/`? If significant new behavior is added, have you described that in `docs/`? --> No. ## Is hotfix candidate? <!-- Is this PR a hotfix candidate or does it require a notification to be sent to the broader community? (Yes/No) --> No. --------- Co-authored-by: Stephan Behnke <stephanos@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This is so much better already. There's more to clean up but this is a good step.
s.OverrideDynamicConfig(dynamicconfig.ActivityAPIsEnabled, true) | ||
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(s.Namespace()) | ||
func TestActivityApiPauseClientTestSuite(t *testing.T) { | ||
s := new(ActivityApiPauseClientTestSuite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add t.Parallel()
to all suites where it doesn't break things?
@@ -262,13 +226,12 @@ func newTemporal(t *testing.T, params *TemporalParams) *TemporalImpl { | |||
hostsByProtocolByService: params.HostsByProtocolByService, | |||
} | |||
|
|||
for k, v := range staticOverrides { | |||
for k, v := range dynamicConfigOverrides { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like it should be possible to merge the "global test overrides" and the ones from "params" (the per-suite ones?) earlier so that this code here is just one loop. Did you consider that?
Like maybe change https://github.com/temporalio/temporal/pull/7096/files#diff-b77e5f4402c434c0f9f4a58cbe72c7fa38e280e235f5d6c393b370301355cd3eR211 to s.testClusterConfig.DynamicConfigOverrides = maps.Clone(dynamicConfigOverrides)
?
What changed?
Why?
Quality of life for function test writers.
How did you test it?
Run.
Potential risks
No risks.
Documentation
No.
Is hotfix candidate?
No.