diff --git a/README.md b/README.md index f06b193a..1c1bc731 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,10 @@ Publishing docker images of the features runner/suites is also supported. It may [manually](https://github.com/temporalio/features/actions/workflows/all-docker-images.yaml), but is also triggered by default on each push to main. +The dynamic configuration file located at `dockerfiles/dynamicconfig/docker.yaml` defines the dynamic configuration +settings needed for features to run, and should be used as part of or all of the dynamic config settings for any +external server not using the basic docker-compose setup. + ## TODO - Add support for replaying testing of all versions _inside_ each SDKs harness as part of the run diff --git a/cmd/run.go b/cmd/run.go index 3ac022be..b0db3b09 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -27,6 +27,7 @@ import ( "go.temporal.io/sdk/client" "go.temporal.io/sdk/log" "go.temporal.io/sdk/testsuite" + "gopkg.in/yaml.v3" ) const ( @@ -200,17 +201,33 @@ func (r *Runner) Run(ctx context.Context, patterns []string) error { // If the server is not set, start it ourselves if r.config.Server == "" { + // Load up dynamic config values. + // Probably the CLI could support passing a dynamic config file as well, but it also likes to set some default + // values for certain things, so it's easier to just load the file here and pass those values explicitly. + cfgPath := filepath.Join(r.rootDir, "dockerfiles", "dynamicconfig", "docker.yaml") + yamlBytes, err := os.ReadFile(cfgPath) + var yamlValues map[string][]struct { + Constraints map[string]any + Value any + } + if err = yaml.Unmarshal(yamlBytes, &yamlValues); err != nil { + return fmt.Errorf("unable to decode dynamic config: %w", err) + } + dynamicConfigArgs := make([]string, 0, len(yamlValues)) + for key, values := range yamlValues { + for _, value := range values { + asJsonStr, err := json.Marshal(value) + if err != nil { + return fmt.Errorf("unable to marshal dynamic config value %s: %w", key, err) + } + dynamicConfigArgs = append(dynamicConfigArgs, "--dynamic-config-value", fmt.Sprintf("%s=%s", key, asJsonStr)) + } + } + server, err := testsuite.StartDevServer(ctx, testsuite.DevServerOptions{ - // TODO(cretz): Configurable? LogLevel: "error", ClientOptions: &client.Options{Namespace: r.config.Namespace}, - ExtraArgs: []string{ - "--dynamic-config-value", "system.forceSearchAttributesCacheRefreshOnRead=true", - "--dynamic-config-value", "system.enableActivityEagerExecution=true", - "--dynamic-config-value", "system.enableEagerWorkflowStart=true", - "--dynamic-config-value", "frontend.enableUpdateWorkflowExecution=true", - "--dynamic-config-value", "frontend.enableUpdateWorkflowExecutionAsyncAccepted=true", - }, + ExtraArgs: dynamicConfigArgs, }) if err != nil { return fmt.Errorf("failed starting devserver: %w", err) diff --git a/dockerfiles/dynamicconfig/docker.yaml b/dockerfiles/dynamicconfig/docker.yaml index 1cf95977..e4fba6e9 100644 --- a/dockerfiles/dynamicconfig/docker.yaml +++ b/dockerfiles/dynamicconfig/docker.yaml @@ -1,3 +1,12 @@ +frontend.forceSearchAttributesCacheRefreshOnRead: + - value: true + constraints: {} +frontend.enableActivityEagerExecution: + - value: true + constraints: {} +frontend.enableEagerWorkflowStart: + - value: true + constraints: {} frontend.enableUpdateWorkflowExecution: - value: true constraints: {}