@@ -27,6 +27,7 @@ import (
27
27
"go.temporal.io/sdk/client"
28
28
"go.temporal.io/sdk/log"
29
29
"go.temporal.io/sdk/testsuite"
30
+ "gopkg.in/yaml.v3"
30
31
)
31
32
32
33
const (
@@ -200,17 +201,33 @@ func (r *Runner) Run(ctx context.Context, patterns []string) error {
200
201
201
202
// If the server is not set, start it ourselves
202
203
if r .config .Server == "" {
204
+ // Load up dynamic config values.
205
+ // Probably the CLI could support passing a dynamic config file as well, but it also likes to set some default
206
+ // values for certain things, so it's easier to just load the file here and pass those values explicitly.
207
+ cfgPath := filepath .Join (r .rootDir , "dockerfiles" , "dynamicconfig" , "docker.yaml" )
208
+ yamlBytes , err := os .ReadFile (cfgPath )
209
+ var yamlValues map [string ][]struct {
210
+ Constraints map [string ]any
211
+ Value any
212
+ }
213
+ if err = yaml .Unmarshal (yamlBytes , & yamlValues ); err != nil {
214
+ return fmt .Errorf ("unable to decode dynamic config: %w" , err )
215
+ }
216
+ dynamicConfigArgs := make ([]string , 0 , len (yamlValues ))
217
+ for key , values := range yamlValues {
218
+ for _ , value := range values {
219
+ asJsonStr , err := json .Marshal (value )
220
+ if err != nil {
221
+ return fmt .Errorf ("unable to marshal dynamic config value %s: %w" , key , err )
222
+ }
223
+ dynamicConfigArgs = append (dynamicConfigArgs , "--dynamic-config-value" , fmt .Sprintf ("%s=%s" , key , asJsonStr ))
224
+ }
225
+ }
226
+
203
227
server , err := testsuite .StartDevServer (ctx , testsuite.DevServerOptions {
204
- // TODO(cretz): Configurable?
205
228
LogLevel : "error" ,
206
229
ClientOptions : & client.Options {Namespace : r .config .Namespace },
207
- ExtraArgs : []string {
208
- "--dynamic-config-value" , "system.forceSearchAttributesCacheRefreshOnRead=true" ,
209
- "--dynamic-config-value" , "system.enableActivityEagerExecution=true" ,
210
- "--dynamic-config-value" , "system.enableEagerWorkflowStart=true" ,
211
- "--dynamic-config-value" , "frontend.enableUpdateWorkflowExecution=true" ,
212
- "--dynamic-config-value" , "frontend.enableUpdateWorkflowExecutionAsyncAccepted=true" ,
213
- },
230
+ ExtraArgs : dynamicConfigArgs ,
214
231
})
215
232
if err != nil {
216
233
return fmt .Errorf ("failed starting devserver: %w" , err )
0 commit comments