In my TS project I am using TestWorkflowEnvironment to run some tests. I am trying out custom search attributes, and I defined these attributes in Temporal Cloud via temporal CLI, and I added some searchAttribute options to my executeChild workflow command. My local automated tests fail, however, with the error “BadSearchAttributes: Namespace default has no mapping defined for search attribute…”
The error makes sense, I don’t specify a namespace in my test so it uses default, and in my real environments the namespace is something else. So I am just looking for a way to set in code (e.g. in my before() function) the default namespace search attributes and add my custom ones.
Thanks, this basically worked. I am first doing TestLocalEnvironment.createLocal() and then passing the returned TestWorkflowEnvironment nativeConnection to my worker. So I was originally looking for operatorService on the nativeConnection, but it is not there. TestWorkflowEnvironment has BOTH a connection and nativeConnection. Calling that TestWorkflowEnvironment’s connection.operatorService.addSearchAttributes worked. I hope that helps anyone else confused by this.