Test executor finished with non-zero exit value 2

I have a build which runs fine locally. I’m trying to get it working under the “Go” CI environment. The build runs without incident, but attempting to run the tests invariably produces:

Process 'Gradle Test Executor 7' finished with non-zero exit value 2
This problem might be caused by incorrect test process configuration.

(It’s not always 7, I assume the executor number isn’t relevant.)

I appreciate the suggestion that I might have borked the test process configuration. User error is the most likely cause. But if I run the tests on that host, they run fine.

Can anyone suggest what. “exit value 2” indicates? I gather that some of the other magic numbers are related to memory usage and such. But I haven’t found a list of them.

That just means what it says, that the test process exited with exit value 2.
If you write a test method and in there System.exit(2) it will look exactly like that.
You probably need to debug your code to see where this exit comes from.
Or maybe you could try to set a breakpoint in System.exit, or install a security manager that throws an exception if System.exit is called or just logs a stacktrace.

I considered that possibility just the other day. It only happens in CI, not on my local build, so I assumed it was something more to do with the Gradle environment. But I’ve been wrong before. I shall dig in and see what I can find.