vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

Configurable server port for the tests

Open percyashu opened this issue 1 year ago • 9 comments

Motivation: #465

Run test with port if it is specified e.g mvn test -Dport=8888.

Conformance:

Your commits should be signed and you should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines

percyashu avatar Nov 17 '23 13:11 percyashu

I think instead we should use the constant defined in vertx-core : HttpTestBase#DEFAULT_HTTP_PORT and make the vertx-core constant overridable with a system property

vietj avatar Nov 17 '23 18:11 vietj

@vietj I don't quite understand. Can you elaborate further?

percyashu avatar Nov 18 '23 06:11 percyashu

@vietj let me give you some context. @percyashu is a former GSoC candidate, who is willing to contribute to Vert.x Web. We have talked off-list and he picked #465 which is marked wit the help wanted label.

As discussed with @pmlopes in the ticket, the idea is to use random ports for tests but, for debugging purposes, rely on a sysprop to determine if a fix port should be used instead. All in all, this is comparable to the behavior of sql client tests.

The motivation is to reduce the number of intermittent failures, by removing those due to servers being already bound to port 8080.

tsegismont avatar Nov 21 '23 10:11 tsegismont

@percyashu in vertx-core tests we do have a constant DEFAULT_HTTP_PORT = 8080 (https://github.com/eclipse-vertx/vert.x/blob/d2fcda6283f327f505a79ed187afe7752ec75187/src/test/java/io/vertx/core/http/HttpTestBase.java#L37)

This constant could be loaded from a system property (e.g. vertx.defaultHttpPort) or be 8080 when there is no such system property, and Vertx-web could reuse this property. That would allow vertx-core which is already using this property to be configured with a different port for testing.

vietj avatar Nov 21 '23 13:11 vietj

Ok @vietj, From my understanding this will involve first making the change to HttpTestBase, then extending it in the baseTest classes like WebTestBase or SockJSTestBase instead of directly extending VertxTestBase right?

percyashu avatar Nov 27 '23 11:11 percyashu

I think you can just reuse the constant when there is no extension, e.g HttpTestBase.SERVER_PORT

On Mon, Nov 27, 2023 at 12:19 PM Percy Enoabane @.***> wrote:

Ok @vietj https://github.com/vietj, From my understanding this will involve first making the change to HttpTestBase, then extending it in the baseTest classes like WebTestBase or SockJSTestBase instead of directly extending VertxTestBase right?

— Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-web/pull/2513#issuecomment-1827638064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXDCRJPKHION7VGNPKGMLYGRZNHAVCNFSM6AAAAAA7PYL6L6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRXGYZTQMBWGQ . You are receiving this because you were mentioned.Message ID: @.***>

vietj avatar Nov 27 '23 13:11 vietj

thanks for the contribution @percyashu

vietj avatar Dec 20 '23 16:12 vietj

@vietj and @tsegismont the next steps will be to use HttpTestBase.DEFAULT_HTTP_PORT in this PR right?

percyashu avatar Dec 20 '23 17:12 percyashu

I think yes but instead vertx-web should have its own same constants that are copied from those, in case we want to refactor those in vertx-core (e.g move them to a constant class).

On Wed, Dec 20, 2023 at 6:11 PM Percy Enoabane @.***> wrote:

@vietj and @tsegismont the next steps will be to use HttpTestBase.DEFAULT_HTTP_PORT in this PR right?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

vietj avatar Dec 21 '23 08:12 vietj