vert-x3 / vertx-web

HTTP web applications for Vert.x
Apache License 2.0
1.11k stars 535 forks source link

Configurable server port for the tests #2513

Open percyashu opened 1 year ago

percyashu commented 1 year ago

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

vietj commented 1 year ago

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

percyashu commented 1 year ago

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

tsegismont commented 1 year ago

@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.

vietj commented 1 year ago

@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.

percyashu commented 12 months ago

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?

vietj commented 12 months ago

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 commented 11 months ago

thanks for the contribution @percyashu

percyashu commented 11 months ago

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

vietj commented 11 months ago

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: @.***>