Quarkus quickstart example test - Connection refused - testing

Beginning with Quarkus, I build the getting-started-example and it works fine. But if I run the tests with mvn test it doesn't work, I'm getting a connection refused error. The port 8081 is ok, so what's wrong with it?
[INFO] Running org.acme.quickstart.GreetingResourceTest
2020-02-20 07:55:20,150 INFO [io.quarkus] (main) Quarkus 1.1.0.Final started in 0.080s.
2020-02-20 07:55:20,154 INFO [io.quarkus] (main) Profile test activated.
2020-02-20 07:55:20,154 INFO [io.quarkus] (main) Installed features: []
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 6.345 s <<< FAILURE! - in org.acme.quickstart.GreetingResourceTest
[ERROR] testHelloEndpoint Time elapsed: 3.192 s <<< ERROR!
java.net.ConnectException: Connection refused: connect
at org.acme.quickstart.GreetingResourceTest.testHelloEndpoint(GreetingResourceTest.java:17)
[ERROR] testGreetingEndpoint Time elapsed: 2.029 s <<< ERROR!
java.net.ConnectException: Connection refused: connect
at org.acme.quickstart.GreetingResourceTest.testGreetingEndpoint(GreetingResourceTest.java:23)

Updating Quarkus to 1.2.1.Final solved the problem, tests are working now.

Related

Timed out connecting to Chrome, giving up error - EC2 instance jenkins running selenium tests

I'm receiving the following error when trying to run my selenium tests through an ec2 instance using Jenkins.
Running the tests locally works fine.
The output of the logs:
[[1;34mINFO[m] -------------------------------------------------------
[[1;34mINFO[m] T E S T S
[[1;34mINFO[m] -------------------------------------------------------
[[1;34mINFO[m] Running [1mTestSuite[m
[main] INFO com.DefaultTest - BeforeClass start
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 106.0.5249.61 (resolved driver for Chrome 106)
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /var/lib/jenkins/.cache/selenium/chromedriver/linux64/106.0.5249.61/chromedriver
Starting ChromeDriver 106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249#{#569}) on port 42525
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Oct 11, 2022 11:13:53 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Oct 11, 2022 11:13:55 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 106, so returning the closest version found: a no-op implementation
Oct 11, 2022 11:13:55 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Unable to find CDP implementation matching 106.
Oct 11, 2022 11:13:55 PM org.openqa.selenium.chromium.ChromiumDriver lambda$new$3
WARNING: Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.1.3` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
[main] INFO com.page.MainApp - URL: data:,
[main] INFO com.DefaultTest - AfterClass start
[main] INFO com.DefaultTest - BeforeClass start
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 106.0.5249.61 (resolved driver for Chrome 106)
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /var/lib/jenkins/.cache/selenium/chromedriver/linux64/106.0.5249.61/chromedriver
Starting ChromeDriver 106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249#{#569}) on port 50463
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1665530123.403][WARNING]: Timed out connecting to Chrome, retrying...
[1665530132.591][WARNING]: Timed out connecting to Chrome, retrying...
[1665530149.634][WARNING]: Timed out connecting to Chrome, giving up.
[1665530156.893][WARNING]: Timed out connecting to Chrome, retrying...
[1665530166.364][WARNING]: Timed out connecting to Chrome, retrying...
[1665530186.944][WARNING]: Timed out connecting to Chrome, giving up.
Build timed out (after 3 minutes). Marking the build as failed.
[[1;34mINFO[m]
[[1;34mINFO[m] Results:
[[1;34mINFO[m]
[[1;34mINFO[m] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[[1;34mINFO[m]
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1;31mBUILD FAILURE[m
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] Total time: 03:07 min
[[1;34mINFO[m] Finished at: 2022-10-11T23:16:40Z
I'm not sure how to resolve this.
I have google chrome and chromedriver on the same version (v106).
I've attempted adding countless arguments that people have suggested, but still can't get it to run successfully

Does karate support headless testing in CI environment (gitlab CI)

We have done UI automation using karate framework. But I am facing challenges while trying to run the tests using gitlab pipeline.
I am using gradle build tool and added a simple step in the gitlab-ci.yaml, but the build fails every time. Here is what I tried:
Added this in feature file:
* configure driver = { type: 'chrome', headless: true }
Got the error:
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {}->http://localhost:9222
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to localhost/127.0.0.1:9222
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-8: Shutdown connection
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded
18:10:39.057 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 8][route: {}->http://localhost:9222][total available: 0; route allocated: 0 of 5; total allocated: 0 of 10]
18:10:39.057 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1] failed: Connection refused (Connection refused), http call failed after 1 milliseconds for URL: http://localhost:9222
Also, tried by adding chromedriver: * configure driver = { type: 'chromedriver', port: 9515, executable: 'chromedriver' }. Got this error:
18:19:01.541 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {}->http://localhost:9515][total available: 0; route allocated: 0 of 5; total allocated: 0 of 10]
18:19:01.542 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1] failed: Connection refused (Connection refused), http call failed after 19 milliseconds for URL: http://localhost:9515/session
18:19:01.542 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - http request failed:
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
I want to execute the tests on a particular environment when pipeline runs but nothing is working as of now.
We can add the code to install chrome and chrome driver in before_script in .gitlab-ci.yml to solve the issue mentioned.
before_script:
- apt-get update && apt-get install -y --no-install-recommends google-chrome-stable
- wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- mv chromedriver /usr/bin/chromedriver
- chown root:root /usr/bin/chromedriver
- chmod +x /usr/bin/chromedriver
UI and CI is not easy, we have documented how to use the karate-chrome container: https://github.com/intuit/karate/tree/master/karate-core#karate-chrome
And others have had success with SaaS providers: https://stackoverflow.com/a/60992292/143475
If you are trying another route, you may need to do some research / digging. And please contribute your findings back to the community.

Rabbitmq server failed to boot

I'm trying to start my rabbitmq server using command:sudo rabbitmq-server on ubuntu 20.04 but it crashes.I have absolutely no clue whatsoever as to what I should do.
Rabbitmq version: 3.8.5 erlang version: 23
17:41:07.587 [error]
17:41:07.591 [error] BOOT FAILED
BOOT FAILED
17:41:07.592 [error] ===========
===========
17:41:07.592 [error] ERROR: distribution port 25672 in use by rabbit#nadaanbaalak
ERROR: distribution port 25672 in use by rabbit#nadaanbaalak
17:41:07.592 [error]
17:41:08.594 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {dist_port_already_used,25672,"rabbit","nadaanbaalak"} in context start_error
17:41:08.594 [error] CRASH REPORT Process <0.153.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","nadaanbaalak"}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"nadaanbaalak\"}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","nadaanbaalak"}}},{rabb
Crash dump is being written to: erl_crash.dump...done
Any help would be great
It's pretty simple. Just needed to look at the logs. killed the process at the port number "25672" and restarted the rabbitmq server.

Selenium in Jenkins failure test

I'm trying to run selenium in Jenkins. When I run it locally the test always passed. But in Jenkins I always get error:
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#ee7d9f1
Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on port 10010
Only local connections are allowed.
Dec 18, 2017 2:35:43 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
File cannot be found
Tests run: 4, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 6.807 sec <<< FAILURE!
no such element: Unable to locate element:
Im using Jenkins, Selenium and Testing
This issue is related to your mac, and is a connection issue to other server on which you are running your script. for resolving this issue please read this: https://discussions.apple.com/thread/1789752

Error when generating Cucumber report in Maven

I use Java and Cucumber to run my test. My test passed and I want to generate a report after running the test by using Cucumber. So I run terminal: mvn clean verify. But I got these error as below:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running mgl.example.RunTest
#first
Feature: Test drag-drop and scroll options
Scenario: Drag-drop and scroll must be OK # MoveAndScroll.feature:3
Given I move from the root role dialog to choosing picture # AddNewDevice.i_move_from_the_root_role_dialog_to_choosing_picture()
When I Choose picture and click continue # AddNewDevice.i_Choose_picture_and_click_continue()
Then I can drag-drop device and scroll options # AddNewDevice.i_can_drag_drop_device_and_scroll_options()
1 Scenarios (1 passed)
3 Steps (3 passed)
2m12.865s
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 133.918 sec - in mgl.example.RunTest
Results :
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # Example ---
[INFO] Building jar: /Users/enclaveit/Documents/workspace/Example/target/Example-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-cucumber-reporting:0.0.6:generate (execution) # Example ---
About to generate
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:24 min
[INFO] Finished at: 2014-06-17T17:07:09+07:00
[INFO] Final Memory: 16M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:0.0.6:generate (execution) on project Example: Error Found: BUILD FAILED - Check Report For Details -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.masterthought:maven-cucumber-reporting:0.0.6:generate (execution) on project Example: Error Found:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error Found:
at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:86)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.plugin.MojoExecutionException: BUILD FAILED - Check Report For Details
at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:82)
... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Can somebody help me?
I ran into the same problem. The tests are executed, the report is generated but the BUILD FAILURE. This is the case if there are some validation errors. However, if I run the all-passing test cases then BUILD SUCCESS.
I guess if one of the test cases fails then BUILD FAILURE. If no failure in the run then BUILD SUCCESS. This is what I think.
There are some other questions about the POM:
failIfNoTests>false</failIfNoTests
testFailureIgnore>true</testFailureIgnore
These two lines above need to be inside sure-fire