I'm trying to test a server plugin from within a unit test. I've tried my best to set up the unit tests the same as this project.
The issue I am having with my code is with the InProcessServer created by the PersistenceContext class. The InProcessServer starts on the first port available from 7474, and so for my tests, several InProcessServers are created, I think because new tests run before the port from the previous test is closed?
In other words, during test execution, I will find in process servers open in my browser on localhost:7474, localhost:7475, localhost, 7476 and so on...
Of course, this means when it comes to testing server plugins, during test execution I don't know which port I'm going to be testing against, or which database I'm going to hit. If I run my server plugin integration tests individually they run fine.
My questions are:
1) Have I understood all of this right in the first place?
2) How can I test a server plugin as part of a larger integration test if I can't specify the port along with the server plugin uri in advance? Is there a clean way to find out the server port currently in use for a test at runtime?