mwinteringham / restful-booker-platform

A SaaS platform used for various test automation training
http://www.automationintesting.com
GNU General Public License v3.0
128 stars 158 forks source link

SmokeTest failed with "unknown error: net::ERR_CONNECTION_REFUSED" #221

Closed karunakaran1983 closed 2 years ago

karunakaran1983 commented 2 years ago

Hi Team, I tried to build restful-booker-platform using build_locally.cmd

[INFO] Reactor Summary: [INFO] [INFO] restful-booker-platform-auth 1.6.SNAPSHOT .......... SUCCESS [ 12.739 s] [INFO] restful-booker-platform-booking 1.6.SNAPSHOT ....... SUCCESS [ 19.089 s] [INFO] restful-booker-platform-room 1.6.SNAPSHOT .......... SUCCESS [ 11.733 s] [INFO] restful-booker-platform-report 1.6.SNAPSHOT ........ SUCCESS [ 12.309 s] [INFO] restful-booker-platform-branding 1.6.SNAPSHOT ...... SUCCESS [ 16.451 s] [INFO] restful-booker-platform-message 1.6.SNAPSHOT ....... SUCCESS [ 19.677 s] [INFO] restful-booker-platform-assets-js 1.5.SNAPSHOT ..... SUCCESS [ 43.847 s] [INFO] restful-booker-platform-assets 1.6.SNAPSHOT ........ SUCCESS [ 8.439 s] [INFO] restful-booker-platform-local-proxy 1.6.SNAPSHOT ... SUCCESS [ 0.371 s] [INFO] restful-booker-platform 1.6.SNAPSHOT ............... SUCCESS [ 0.009 s]

SmokeTest failed with below error: (Attaching build.log) org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_REFUSED

Requirements version in my machine: C:\Users\ramya>java -version java version "16.0.2" 2021-07-20 Java(TM) SE Runtime Environment (build 16.0.2+7-67) Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

C:\Users\ramya>mvn --version Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\Program Files\apache-maven-3.6.3\bin.. Java version: 16.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-16.0.2 Default locale: en_US, platform encoding: UTF-8 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

C:\Users\ramya>node -v v16.15.1

C:\Users\ramya>npm -v npm WARN config global --global, --local are deprecated. Use --location=global instead. 8.11.0

Kindly help what I am missing to successfully build. Thanks

build.log

mwinteringham commented 2 years ago

If you run the build process, let the e2e checks fail and then head to localhost:8080 what do you see? If the site is up then it might be an issue on your end around how the checks connect to your driver instance.

karunakaran1983 commented 2 years ago

@mwinteringham I just ran again and when I head to localhost:8080, it shows "This site can’t be reached" (Snap attached)

During e2e test, chrome tried to launch for 6 times and closed with below error:

[ERROR] bookingSmokeTest Time elapsed: 5.643 s <<< ERROR! org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_REFUSED (Session info: chrome=107.0.5304.107) Build info: version: '4.2.1', revision: 'ac4d0fdd4a' System info: host: 'LAPTOP-6AQ13BQL', ip: '192.168.68.108', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '16.0.2' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [5ba8c58bddd255e9f04f21cafb6646eb, get {url=http://localhost:8080/#/admin}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 107.0.5304.107, chrome: {chromedriverVersion: 107.0.5304.62 (1eec40d3a576..., userDataDir: C:\Users\ramya\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:51771}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://localhost:51771/devtoo..., se:cdpVersion: 107.0.5304.107, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true} Session ID: 5ba8c58bddd255e9f04f21cafb6646eb at SmokeTest.logIntoApplication(SmokeTest.java:16)

Please suggest your thoughts. Thanks

localhost refused to connect

mwinteringham commented 2 years ago

Interesting. Could be the proxy isn't loading up. What if you were to go to here once the E2E checks have failed (Don't exit the script once the failure has occurred)

http://localhost:3004/auth/actuator/logfile

karunakaran1983 commented 2 years ago

@mwinteringham I got below info when navigated to http://localhost:3004/auth/actuator/logfile

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.7.3)

2022-11-15 12:44:49.584 INFO 23236 --- [ main] c.a.api.AuthApplication : Starting AuthApplication v1.6.SNAPSHOT using Java 16.0.2 on LAPTOP-6AQ13BQL with PID 23236 (C:\K\restful-booker-platform\auth\target\restful-booker-platform-auth-1.6.SNAPSHOT-exec.jar started by ramya in C:\K\restful-booker-platform) 2022-11-15 12:44:49.593 INFO 23236 --- [ main] c.a.api.AuthApplication : The following 1 profile is active: "dev" 2022-11-15 12:44:55.907 INFO 23236 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 3004 (http) 2022-11-15 12:44:55.931 INFO 23236 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-11-15 12:44:55.932 INFO 23236 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65] 2022-11-15 12:44:56.175 INFO 23236 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/auth] : Initializing Spring embedded WebApplicationContext 2022-11-15 12:44:56.175 INFO 23236 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 6477 ms 2022-11-15 12:44:59.525 INFO 23236 --- [ main] com.automationintesting.db.AuthDB : DB server mode disabled 2022-11-15 12:45:10.365 INFO 23236 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator' 2022-11-15 12:45:10.479 INFO 23236 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 3004 (http) with context path '/auth' 2022-11-15 12:45:10.502 INFO 23236 --- [ main] c.a.api.AuthApplication : Started AuthApplication in 22.466 seconds (JVM running for 23.64) 2022-11-15 12:45:11.099 INFO 23236 --- [ main] c.a.service.DatabaseScheduler : No env var was set for DB refresh (or set as 0) so not running DB reset 2022-11-15 12:45:12.591 INFO 23236 --- [nio-3004-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/auth] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2022-11-15 12:45:12.594 INFO 23236 --- [nio-3004-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2022-11-15 12:45:12.607 INFO 23236 --- [nio-3004-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 12 ms

mwinteringham commented 2 years ago

Yep so the proxy isn't on 🤦

Would you mind testing something out for me. Change line 35 of run_locally.cmd from

START /B java -jar assets/api/target/%proxy_jar% > ui.log

To

START /B java -jar proxy/target/%proxy_jar% > ui.log

And then re-run the build again

karunakaran1983 commented 2 years ago

@mwinteringham Yes I did the changes suggested by you and re-ran the build.

Please find the info from http://localhost:3004/auth/actuator/logfile . _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.7.3)

2022-11-15 14:38:23.771 INFO 4264 --- [ main] c.a.api.AuthApplication : Starting AuthApplication v1.6.SNAPSHOT using Java 16.0.2 on LAPTOP-6AQ13BQL with PID 4264 (C:\K\restful-booker-platform\auth\target\restful-booker-platform-auth-1.6.SNAPSHOT-exec.jar started by ramya in C:\K\restful-booker-platform) 2022-11-15 14:38:23.774 INFO 4264 --- [ main] c.a.api.AuthApplication : The following 1 profile is active: "dev" 2022-11-15 14:38:30.134 INFO 4264 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 3004 (http) 2022-11-15 14:38:30.388 INFO 4264 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-11-15 14:38:30.392 INFO 4264 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65] 2022-11-15 14:38:30.893 INFO 4264 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/auth] : Initializing Spring embedded WebApplicationContext 2022-11-15 14:38:30.893 INFO 4264 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 6924 ms 2022-11-15 14:38:33.006 INFO 4264 --- [ main] com.automationintesting.db.AuthDB : DB server mode disabled 2022-11-15 14:38:42.778 INFO 4264 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator' 2022-11-15 14:38:42.949 INFO 4264 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 3004 (http) with context path '/auth' 2022-11-15 14:38:43.135 INFO 4264 --- [ main] c.a.api.AuthApplication : Started AuthApplication in 21.086 seconds (JVM running for 22.69) 2022-11-15 14:38:43.236 INFO 4264 --- [ main] c.a.service.DatabaseScheduler : No env var was set for DB refresh (or set as 0) so not running DB reset 2022-11-15 14:38:46.397 INFO 4264 --- [nio-3004-exec-3] o.a.c.c.C.[Tomcat].[localhost].[/auth] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2022-11-15 14:38:46.397 INFO 4264 --- [nio-3004-exec-3] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2022-11-15 14:38:46.398 INFO 4264 --- [nio-3004-exec-3] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms

run_locally cmd changes

mwinteringham commented 2 years ago

And did the E2E checks pass this time?

karunakaran1983 commented 2 years ago

Nope, same error as before (attaching build.log)

build.log

mwinteringham commented 2 years ago

Ok leave this with me. I need to do some testing on Windows to get the run local script working again

karunakaran1983 commented 2 years ago

Thanks @mwinteringham for your time. Please keep me posted :)

mwinteringham commented 2 years ago

Realised I sent you the wrong replacement code. Would you mind trying again replacing lines 34 and 35 with the following:

for /f "delims=" %%a in ('dir proxy\target\*.jar /B /O:D') do set "proxy_jar=%%a"
START /B java -jar proxy/target/%proxy_jar% > proxy.log
karunakaran1983 commented 2 years ago

You are amazing! Thanks @mwinteringham

image

mwinteringham commented 2 years ago

Well I did break the code to begin with so let's call it even. :p

I'll commit the fix tonight and close this issue down then. Thanks for helping me test it out.