Admin user in tests can't create process instances


Hi folks, a strange issue here.

Our unit tests have been running fine so far, but we needed to test something that queried the current authenticated user’s name. And we hit a snag - it seems by default the junit tests don’t run as a user.

However, if I set the tests up with:


where “demo” is the user configured in our application.yaml as the admin-user - then I get an error when I create a process:

org.camunda.bpm.engine.AuthorizationException: The user with id 'demo' does not have 'CREATE' permission on resource 'ProcessInstance'.

However if I query the user with:


I get true - it’s the admin user, it should be able to do everything. I can log in as that user on the console and trigger whatever activities I want.

Any thoughts? Do I need to jump through hoops to set this user up with more permissions, somehow?


Update - I worked it out. I needed to set the authenticated user groups as well - seems setAuthenticatedUserId doesn’t set groups!

    camundaTestService.getIdentityService().setAuthentication("demo", ImmutableList.of("camunda-admin"));