Closed damiendurant closed 5 years ago
Hi,
I have found the root cause of the issue. It's related to proxy configuration. Proxy settings are not used for code coverage compute. This is due to \src\main\java\com\sforce\cd\apexUnit\client\codeCoverage\WebServiceInvoker.java classe that instanciate httpclient without taking care of proxy.
I debug this setting :
System.out.println("Setting my PROXY"); HostConfiguration hostConfiguration = httpclient.getHostConfiguration(); hostConfiguration.setProxy("XXXXXX",XXXXXX); httpclient.setHostConfiguration(hostConfiguration);
in both method that instanciate httpclient.
How can we fix this quickly ?
@rduvvarapu can you please review this issue and the proposed PR? mvn CLI options suggested https://medium.com/@petehouston/execute-maven-behind-a-corporate-proxy-network-5e08d075f744 could also be helpful. I am unsure if @damiendurant has given it a try
@damiendurant Can you please confirm whether you tried mvn CLI option for proxy
Hi, @rduvvarapu
mvl cli option didn't work, it provide the same error message. In any case, what the point of providing a proxy option on the tool if it work only at 50%.
Thank you @damiendurant, will review and provide you updates.
Hi,
I execute my run from jenkins cli, with the following commande line :
mvn -X compile exec:java -Dexec.mainClass="com.sforce.cd.apexUnit.ApexUnitRunner" -Dexec.args="-max.test.execution.time.threshold 2 -regex.for.selecting.source.classes.for.code.coverage.computation RSales*_SearchAccount_CTRL -regex.for.selecting.test.classes.to.execute RSalesST_SearchAccount_CTRL_Te* -org.login.url https://XXXXX--XXXXX.csXX.my.salesforce.com -org.username XXXXXXXX -org.password XXXXXX -org.client.secret XXXXXXX -proxy.host web-XXXXXXXX -proxy.port 3128 -org.client.id XXXXXXXXXXX"
The first part (execution of test class), run sucessefully, therefore it then throw timeout when trying to fetch code converage :
[com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitRunner - #################################### Computing code coverage for the team based on the Apex Class names(source class names) provided #################################### [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer - Fetching apex classes with regex : RSales*_SearchAccount_CTRL [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex(es): RSales*_SearchAccount_CTRL to fetch apex classes [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Using regex: "RSales*_SearchAccount_CTRL" to fetch apex classes [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched Apex classes: [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - ApexClassId : 01pb00000050stAAAQ ApexClassName : RSalesST_SearchAccount_CTRL [com.sforce.cd.apexUnit.ApexUnitRunner.main()] DEBUG com.sforce.cd.apexUnit.client.utils.ApexClassFetcherUtils - Fetched Apex classes: Jul 26, 2018 3:49:25 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out (Connection timed out) Jul 26, 2018 3:49:25 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jul 26, 2018 3:51:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out (Connection timed out) Jul 26, 2018 3:51:32 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request Jul 26, 2018 3:53:40 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out (Connection timed out) Jul 26, 2018 3:53:40 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: Retrying request java.net.ConnectException: Connection timed out (Connection timed out) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673) at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:477) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:153) at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:82) at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:127) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at com.sforce.cd.apexUnit.client.codeCoverage.WebServiceInvoker.doPost(WebServiceInvoker.java:78) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.doPostAndGetOrgToken(OAuthTokenGenerator.java:49) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.getOrgToken(OAuthTokenGenerator.java:36) at com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer.calculateAggregatedCodeCoverageUsingToolingAPI(CodeCoverageComputer.java:104) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:748) [com.sforce.cd.apexUnit.ApexUnitRunner.main()] ERROR com.sforce.cd.apexUnit.ApexUnitUtils - Exception during post method: java.net.ConnectException: Connection timed out (Connection timed out) [com.sforce.cd.apexUnit.ApexUnitRunner.main()] INFO com.sforce.cd.apexUnit.ApexUnitUtils - Shutting down ApexUnit java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1336) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithErrMsg(ApexUnitUtils.java:48) at com.sforce.cd.apexUnit.ApexUnitUtils.shutDownWithDebugLog(ApexUnitUtils.java:33) at com.sforce.cd.apexUnit.client.codeCoverage.WebServiceInvoker.doPost(WebServiceInvoker.java:87) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.doPostAndGetOrgToken(OAuthTokenGenerator.java:49) at com.sforce.cd.apexUnit.client.codeCoverage.OAuthTokenGenerator.getOrgToken(OAuthTokenGenerator.java:36) at com.sforce.cd.apexUnit.client.codeCoverage.CodeCoverageComputer.calculateAggregatedCodeCoverageUsingToolingAPI(CodeCoverageComputer.java:104) at com.sforce.cd.apexUnit.ApexUnitRunner.main(ApexUnitRunner.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:748) Build step 'Execute shell' marked build as failure