I'm attempting to move an integration away from using Custom SObjects and to using Platform Events out of a concern for storage space (and also so our eventual automation of this integration won't have to delete 500k rows before each run).
I have the Platform Event, a Platform Event Trigger, and a PlatformEventSubscriberConfig (which is still a real hassle to create and edit) to change the running user away from "Automated Process User". I've made myself the running user and the subscriber config has taken effect, as I can see the logs when I publish an appropriate Platform Event from anonymous apex.
When I publish a Platform Event from the unit test meant to stress the Platform Event Trigger, however, Salesforce appears to be ignoring my configuration.
In my case, that's causing a test method to run afoul of a validation rule (PE causes an Account name to be changed, and only certain profiles are allowed to do that. The "Automated Process" profile is currently not in the pass-list).
I can, and have, worked around the issue for this one particular test failure, but it seems wrong to me that Salesforce isn't honoring the configuration I set up. I imagine that this is a side-effect of how Salesforce is currently isolating the Event Bus for tests.
Is there a way to force Salesforce to set a running user for a Platform Event Trigger in a unit test (or force Salesforce to honor the configuration I've already set up)?