Problems when creating internal directories and loading users

Hey,

we have some issues while developing for Confluence. We have a lot of integration tests that will basically create a new internal directory, add/remove/update users, and then delete the directory of this test.

However, this leads to problems around 30% to 50% of the time when running the tests. Sometimes the Confluence users cannot be loaded/found (are null), or the directory that has been created is just gone.

Running these tests in isolation usually works. For Directory operations, we use the CrowdDirectoryService, and for adding users we use the DirectoryManager.

We don’t have a real clue what is going on. Some hypotheses are:

  • There is some caching going on and by repeatedly creating/deleting directories, the cache is broken. Maybe we need to send some events?
  • We are too fast … as we all know Confluence performance when it comes to larger operations is not that optimal …

Has anyone seen something similar when it comes to Confluence and user directories?

Best regards,
Christopher

We had similar problems, which were (probably) related to indexing. Esp. with more nodes, indexing might be slow… (If I’m right, XYZSearchServices use the index…)

Some workaround: “sleep” or catch-and-try-again…, let the cleanup job run after and before new tests …

For events: check that you send the correct events to invalidate remote caches…
You maybe also can directly trigger indexing for new entities you’ve created in your own code