You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Manikandan R (Jira)" <ji...@apache.org> on 2026/07/28 06:20:00 UTC
[jira] [Resolved] (YUNIKORN-3337) Fix connection refused error in webservice unit tests
[ https://issues.apache.org/jira/browse/YUNIKORN-3337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Manikandan R resolved YUNIKORN-3337.
------------------------------------
Fix Version/s: 1.10.0
Target Version: 1.10.0
Resolution: Fixed
> Fix connection refused error in webservice unit tests
> ------------------------------------------------------
>
> Key: YUNIKORN-3337
> URL: https://issues.apache.org/jira/browse/YUNIKORN-3337
> Project: Apache YuniKorn
> Issue Type: Bug
> Components: test - unit
> Reporter: weichen lai
> Assignee: weichen lai
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.10.0
>
>
> When running unit tests in `pkg/webservice` locally (e.g., under WSL via `make test`), tests can fail with `connection refused` errors:
> {code:java}
> 2026-07-26T10:09:29.610+0800 INFO core.rest webservice/streaming_limit.go:54 Reloading streaming limit settings
> 2026-07-26T10:09:29.611+0800 INFO core.rest webservice/webservice.go:74 web-app started {"port": 9080}
> --- FAIL: Test_RedirectDebugHandler (0.00s)
> --- FAIL: Test_RedirectDebugHandler/statedump (0.00s)
> webservice_test.go:67: assertion failed: error is not nil: Get "http://localhost:9080/ws/v1/fullstatedump": dial tcp 127.0.0.1:9080: connect: connection refused: unexpected error returned
> --- FAIL: Test_RedirectDebugHandler/stacks (0.00s)
> webservice_test.go:67: assertion failed: error is not nil: Get "http://localhost:9080/ws/v1/stack": dial tcp 127.0.0.1:9080: connect: connection refused: unexpected error returned
> 2026-07-26T10:09:29.612+0800 INFO core.rest webservice/webservice.go:74 web-app started {"port": 9080}
> --- FAIL: Test_RouterHandling (0.00s)
> webservice_test.go:86: assertion failed: error is not nil: Post "http://localhost:9080/ws/v1/clusters": dial tcp 127.0.0.1:9080: connect: connection refused: unexpected error returned
> 2026-07-26T10:09:29.613+0800 INFO core.rest webservice/webservice.go:74 web-app started {"port": 9080}
> --- FAIL: Test_HeaderChecks (0.00s)
> {code}
>
> This happens because WebService.StartWebApp() launches httpServer.ListenAndServe() asynchronously in a goroutine and returns immediately. Under local environments like WSL with slight CPU scheduling or socket binding delays, test cases issue HTTP requests in less than 1 ms (0.00s), attempting to connect before the OS finishes binding port 9080.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org