Note that there are some explanatory texts on larger screens.

plurals
  1. POJenkins job failed due to tests failed. Source code for tests include AWT GUI tests, how to use Xvfb plugin
    primarykey
    data
    text
    <ul> <li>Environment - Linux. &lt;&lt; I log on to this machine as me (c123456) and then do "<em>sudo su - jenkins</em>"</li> <li>Language - Java</li> <li><p>Project Structure <br/> src/java -- Java source code</p> <p>test/java -- Junit Unit tests</p> <p>src/java-test -- Integration tests</p></li> <li><p>Build system - Gradle</p></li> </ul> <p><strong>build.gradle</strong> sourceSets definitions:</p> <pre><code>sourceSets { main { java { srcDir 'src/java' } } test { java { srcDir 'test/java' } } integrationTest { java { srcDir 'src/java-test' } } } </code></pre> <ul> <li>Lets say I successfully checked out source code for Project "ProjectABC" somewhere.</li> <li><p>When I run "gradle clean build", everything runs fine on my local machine (Windows Win7 desktop) using Cygwin session. Java compile and test run is successful.</p></li> <li><p>When I run "gradle clean build" on a Linux terminal i.e. using a putty Session, it fails during the test task but Java compile part is successful.</p></li> <li><p>When I run "gralde clean build -x test", it works (as we are excluding test task call).</p></li> </ul> <p><strong>Im getting the following error message when I use "gradle clean build" on a putty session:</strong></p> <pre><code>:compileTestJava Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/junit/junit/4.11/junit-4.11.pom Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/junit/junit/4.11/junit-4.11.jar Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar /production/jenkinsAKS/jobs/ProjectABCUtilities/workspace/test/java/com/tr/ids/util/test/tree/TestMultiParentTree.java:5: warning: unmappable character for encoding UTF8 * Copyright � 2005 Thomson MICROMEDEX. All Rights Reserved. ^ /production/jenkinsAKS/jobs/ProjectABCUtilities/workspace/test/java/com/tr/ids/util/test/tree/TestSingleParentTree.java:5: warning: unmappable character for encoding UTF8 * Copyright � 2005 Thomson MICROMEDEX. All Rights Reserved. ^ Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. :processTestResources UP-TO-DATE :testClasses :test Download http://artifactory_server2:8081/artifactory/jcenter-cache/org/jacoco/org.jacoco.agent/0.6.2.201302030002/org.jacoco.agent-0.6.2.201302030002.pom Download http://artifactory_server2:8081/artifactory/jcenter-cache/org/jacoco/org.jacoco.build/0.6.2.201302030002/org.jacoco.build-0.6.2.201302030002.pom Download http://artifactory_server2:8081/artifactory/jcenter-cache/org/jacoco/org.jacoco.agent/0.6.2.201302030002/org.jacoco.agent-0.6.2.201302030002.jar Xlib: connection to "localhost:12.0" refused by server Xlib: PuTTY X11 proxy: wrong authorisation protocol attempted com.tr.ids.util.test.chart.TestChartUtilities &gt; getPieChart FAILED java.lang.InternalError at TestChartUtilities.java:89 com.tr.ids.util.test.chart.TestChartUtilities &gt; getLegend FAILED java.lang.NoClassDefFoundError at TestChartUtilities.java:103 com.tr.ids.util.test.chart.TestChartUtilities &gt; useString FAILED java.lang.NoClassDefFoundError at TestChartUtilities.java:143 140 tests completed, 3 failed :test FAILED FAILURE: Build failed with an exception. </code></pre> <p>As you see above, ":test" task is called at the very last. Only this project ProjectABC has this test case where the test source code has a .java file which includes the following code:</p> <p>i.e. under /test/java/com/tr/ids/util/test/...*.java, *.html</p> <p>The file which is giving problem is: TestChartUtilities.java</p> <p><strong>Test source code - Java file Code snapshot is:</strong>. See lines/line# 89, 103 and 143 where line contains: "result = ChartUtil." keyword</p> <pre><code>package com.tr.ids.util.test.chart; import java.awt.Color; import java.io.UnsupportedEncodingException; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import com.tr.ids.util.api.chart.ChartData; import com.tr.ids.util.api.chart.ChartUtil; import com.tr.ids.util.test.BaseTestCase; .. .... ......more code here ... .... ... // ############################################################################# // Test. // ############################################################################# /** * Test simple string with ampersand character. */ public void getPieChart() { ChartData chartData = new ChartData(); try { chartData.addChartItem(25, new Color(255,255,0)); chartData.addChartItem(25, new Color(255,0,255)); chartData.addChartItem(25, new Color(0,255,255)); } catch (Exception e) { fail("Exception occured while building the ChartData object (probably 0 amount)"); } byte[] result = null; try { result = ChartUtil.drawPieChart(chartData, 300); // &lt;--- line# 89 which is failing. } catch (Exception e) { fail("Exception occured trying to drawPieChart."); } assertNotNull("No pie chart returned", result); } .. .... ......more code here ... .... ... /** * Test simple string with apostrophe and quote characters. */ public void getLegend() { byte[] result = null; try { result = ChartUtil.drawLegend("ff0000", 40); // &lt;--- line# 103 } catch (Exception e) { fail("Exception occured while drawing a legend box"); } assertNotNull("No legend image returned", result); } /** * Test simple string with less than and greater than characters. */ public void useString() { ChartData chartData = new ChartData(); try { chartData.addChartItem(25, new Color(255,255,0)); chartData.addChartItem(25, new Color(255,0,255)); chartData.addChartItem(25, new Color(0,255,255)); } catch (Exception e) { fail("Exception occured while building the ChartData object (probably 0 amount)"); } String graphDesc = null; try { graphDesc = chartData.generateStringRepresentaion(false); } catch (UnsupportedEncodingException e1) { fail("Exception occured while building the ChartData object (probably 0 amount)"); } ChartData chartData2 = new ChartData(); try { chartData2.loadFromString(graphDesc); } catch (NumberFormatException e) { fail("NumberFormatException thrown loading from string"); } catch (Exception e) { e.printStackTrace(); fail("Exception thrown"); } byte[] result = null; try { result = ChartUtil.drawPieChart(chartData2, 300); // &lt;--- line# 143 } catch (Exception e) { fail("Exception occured trying to drawPieChart."); } assertNotNull("No pie chart returned for chart loaded from string", result); } </code></pre> <p>Now, As I mentioned earlier, in Cygwin (Windows local machine), everything works as I may have all the Graphical/AWT settings/tools available on my local machine via Cygwin.</p> <p>Now, what could I be missing???</p> <p>As I also getting the same error (when running via Putty session) in Jenkins job as well, I thought installing / using Jenkins "Xvfb Plugin" would help as it says:</p> <p><em>Lets you control Xvfb virtual frame buffer X11 server with each build. It starts Xvfb before the build starts, and stops it with the build. This is very useful if your build requires X11 access, for instance runs <strong>tests that require GUI</strong>.</em></p> <p>I configured this plugin according to the instructions: <a href="https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin" rel="nofollow">https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin</a> </p> <p>but, it's still giving me an error.</p> <p>Jenkins logs (When I'm not using Jenkins Xvfb plugin) is showing the same error like I'm getting in a Putty session.</p> <p>Similarly, when "gradle clean build -x test" is called, Jenkins job is successful but I have to run "gradle clean build" (which fails).</p> <p>Now, When enabling Jenkins "Xvfb" plugin in Jenkins Global configuration (under Manager Jenkins > Configure System) and at Job's configuration level, I'm getting the following error in Jenkins log during the execution:</p> <pre><code>.. .... 15:30:11 Xvfb starting$ Xvfb :2 -screen 0 1024x768x24 -fbdir /production/jenkinsAKS/2013-08-23_15-30-072456509552045645846xvfb .. ... ... :compileTestJava Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/junit/junit/4.11/junit-4.11.pom Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/junit/junit/4.11/junit-4.11.jar Download http://artifactory_server2:8081/artifactory/libs-thirdparty-local/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar /production/jenkinsAKS/jobs/ProjectABCUtilities/workspace/test/java/com/tr/ids/util/test/tree/TestMultiParentTree.java:5: warning: unmappable character for encoding UTF8 * Copyright � 2005 Thomson MICROMEDEX. All Rights Reserved. ^ /production/jenkinsAKS/jobs/ProjectABCUtilities/workspace/test/java/com/tr/ids/util/test/tree/TestSingleParentTree.java:5: warning: unmappable character for encoding UTF8 * Copyright � 2005 Thomson MICROMEDEX. All Rights Reserved. ^ Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. :processTestResources UP-TO-DATE :testClasses :test Download http://artifactory_server2:8081/artifactory/jcenter-cache/org/jacoco/org.jacoco.agent/0.6.2.201302030002/org.jacoco.agent-0.6.2.201302030002.pom Download http://artifactory_server2:8081/artifactory/jcenter-cache/org/jacoco/org.jacoco.build/0.6.2.201302030002/org.jacoco.build-0.6.2.201302030002.pom Download http://artifactory_server2:8081/artifactory/jcenter-cache/org/jacoco/org.jacoco.agent/0.6.2.201302030002/org.jacoco.agent-0.6.2.201302030002.jar 15:30:51 Xlib: connection to "localhost:16.0" refused by server 15:30:51 Xlib: PuTTY X11 proxy: wrong authorisation protocol attempted 15:30:52 com.tr.ids.util.test.chart.TestChartUtilities &gt; getPieChart FAILED java.lang.InternalError at TestChartUtilities.java:89 com.tr.ids.util.test.chart.TestChartUtilities &gt; getLegend FAILED java.lang.NoClassDefFoundError at TestChartUtilities.java:103 com.tr.ids.util.test.chart.TestChartUtilities &gt; useString FAILED java.lang.NoClassDefFoundError at TestChartUtilities.java:143 140 tests completed, 3 failed :test FAILED FAILURE: Build failed with an exception. </code></pre> <p>As you notice, this time I'm getting lines.</p> <pre><code>15:30:51 Xlib: connection to "localhost:16.0" refused by server 15:30:51 Xlib: PuTTY X11 proxy: wrong authorisation protocol attempted 15:30:52 </code></pre> <p>When at Job level configuration for Xvfb's Advance configurtion, I mentioned value in the box for "Xvfb specific Display name" as 13 or 16 (as per the plugin), I see the same errors for tests part (as I got earlier), but X11 related error this time, comes as:</p> <pre><code>15:31:42 Xvfb starting$ Xvfb :16 -screen 0 1024x768x24 -fbdir /production/jenkinsAKS/2013-08-23_15-31-388454769980302593302xvfb 15:31:42 _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed 15:31:42 _XSERVTransMakeAllCOTSServerListeners: server already running 15:31:42 15:31:42 Fatal server error: 15:31:42 Cannot establish any listening sockets - Make sure an X server isn't already running 15:31:42 unlink: No such file or directory 15:31:42 unlink failed, errno 2 15:31:44 ERROR: Xvfb failed to start, consult the lines above for errors </code></pre> <p>ps -eAf|grep -i xvfb - doesn't show anything running on the Linux server.</p> <p>When Jenkins job runs using Xvfb plugin, it initiates the call to start / stop the X Display during it's execution automatically (as per Xvfb plugin's features on Jenkins Xvfb help page).</p> <p>I also found that X11 forwarding is enabled on Linux machine:</p> <pre><code># grep X11F /etc/ssh/sshd_config X11Forwarding yes # </code></pre> <p>One thing I notice is, the user which I use to run Jenkins is: "jenkins" and once I log to the Linux machine as me (c123456 id) and then do "sudo su - jenkins", then, there's is NO .XAuthority file.</p> <p>Doing: ... does show it exists: ls -ltra ~c123456</p> <pre><code>-rw------- 1 c123456 devgroup 406 Aug 23 13:07 .Xauthority </code></pre> <p>But, the same doesn't exist for user jenkins i.e. ls -ltra ~jenkins (doesn't have any .XAuthority file).</p> <p>Linux $DISPLAY variable is set but "xclock" doesn't work. I have it X11 setting enabled/checked for X11 forwarding (at client side i.e. on my Windows local machine putty setting for target Linux machine session).</p> <p>[c1234563@devserver1 ~]$ echo $DISPLAY localhost:15.0 [c1234563@devserver1 ~]$ xclock X connection to localhost:15.0 broken (explicit kill or server shutdown). [c1234563@devserver1 ~]$</p> <p>I tried this link but still not able to resolve the issue, following what it says to resolve it.</p> <p><a href="http://froebe.net/blog/2008/11/14/getting-xlib-putty-x11-proxy-wrong-authentication-protocol-attempted-i-have-the-answer/" rel="nofollow">http://froebe.net/blog/2008/11/14/getting-xlib-putty-x11-proxy-wrong-authentication-protocol-attempted-i-have-the-answer/</a></p> <p><strong>What could I be missing at this point which can help me</strong>:</p> <p>1) to resolve the tests fail issue using Putty session or through Jenkins job way.</p> <p>2) I'm wondering if Xvfb plugin is doing the X Display using memory frame buffers, then I should not install any X Display server/client on my local Windows machine / target Linux machine like XMing, XVnc/TightVnc etc.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload