systemProperty in test{} section not available to task during test on jenkins build slave

Hi, I have an interesting scenario which has me a bit stumped.

I have some properties that I have set in ~/.gradle/gradle.properties which I am trying to use in my test scenarios. I was of the understanding that if I prefixed them with systemProp. in gradle.properties they where available in all build scenarios but that appears not to be the case (I am very new to gradle so forgive the lack of understanding). I have overcome the lack of the properties by adding systemProp variables in my build test{} section and when I run my test on my local machine everything works brilliantly. I can see the properties being set (machine is running OSX El Capitan and gradlew is 3.1).

We have a CI environment which is now configured to run a jenkins gradle build when I commit to git. Everything was fine until I introduced the use of these variable. The tests that use the variables successfully on my local fail because the variables are coming through as null.

The build slave is running ubuntu 16.04, again the gradlew is 3.1… I am not sure what additional information might be useful but happy to provide what ever may help here. I am completely stumped… I see nothing in the build logs that would indicate a reason for concern.

To add to my confusion, in the build output I can see this come out in the log which tells me the systemProps are being injected to the test jvm for the test build (If I understand things correctly) … see bold -D variables

13:36:48 Starting process ‘Gradle Test Executor 2’. Working directory: /home/jenkins/workspace/SpidaGradleBase Command: /usr/lib/jvm/java-8-oracle/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -DstagingPassword=testpassword -DstagingUrl=http://nexus.test/staging/repo -DstagingUsername=testuser -Dfile.encoding=US-ASCII -Duser.country=US -Duser.language=en -Duser.variant -ea -cp /home/jenkins/.gradle/caches/2.9/workerMain/gradle-worker.jar

I have some println statements in the test that show the value of stagingUrl is coming through to the test class level but for some reason (only on the jenkins slave) the value is null when the task its self executes. My test code snippet is as follows, it is entirely possible there is an issue with the way I am trying to execute the task in test (I am writing a plugin and this test tests the output from a task for that plugin)

    println("PBB Inside SpidaGradleBaseTest")
    println(System.properties.stagingUrl)

    Project project = ProjectBuilder.builder().build()
    project.version = '0.1.0'
    project.extensions.create("nexusRepoExtension", NexusRepoExtension)
    project.getPluginManager ().apply ("maven");
    def task = project.task('retargetDeployManager', type: RetargetDeployTask)
    task.execute()
    assertEquals("http://nexus.test/staging/repo", project.uploadArchives.getRepositories().mavenDeployer.getRepository().getUrl())
    assertEquals("testpassword", project.uploadArchives.getRepositories()
                                                    .mavenDeployer.getRepository().getAuthentication().getPassword())
    assertEquals("testuser", project.uploadArchives.getRepositories()
                                                    .mavenDeployer.getRepository().getAuthentication().getUserName())

thanks
Paul

Please ignore this. Predictably it turned out to be my fault. I was allowing Jenkins to override environment varialbes during the test instead of dictating them. that had a knock on affect for what system properties would be expected.

hopefully no time wasted for anybody. If its possible to do delete this please go ahead.

thanks
Paul