Enabling search attributes in testing workflow environment

Hi, I’m trying to test a manager activity that handles adding/updating/deleting schedules on the temporal server, but I’m hitting a snag with search attributes. Right now I’m using WorkflowEnvironment.start_local to bring up temporalite in the integration tests, but I don’t have a good way of telling that instance to add my custom attributes. I could have the test shell out to tctl for a second, but that seems kludgey; any better way?

The only way is similarly kludgey - use the raw API (same as tctl uses). You can use the raw gRPC operator service call add_search_attributes directly. Here’s how we do the same thing you’re wanting in our SDK tests. Also by default search attribute addition may be eventually consistent, so you’ll need to pass a Temporalite option like this.

FYI, with the next server release we will likely change start_local to use Temporal CLI instead (see this issue) so any temporalite_ params will not work (they are marked experimental).