Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for coverage for scnerario using same ports for http and https #2209

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions http/vertx/src/test/java/io/quarkus/ts/vertx/PortConflictIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.quarkus.ts.vertx;

import static io.quarkus.test.services.Certificate.Format.PEM;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnQuarkusVersion;
import io.quarkus.test.services.Certificate;
import io.quarkus.test.services.QuarkusApplication;

@QuarkusScenario
@DisabledOnQuarkusVersion(version = "3\\.(8|9|10|11|12|13|14)\\..*|3\\.15\\.(0|1)(\\..*)?", reason = "Disabled on Quarkus versions before 3.15.2 due to known port conflict issue https://github.com/quarkusio/quarkus/issues/43373")
public class PortConflictIT {

static final int COMMON_PORT_HTTP_HTTPS = 50000;
@QuarkusApplication(ssl = true, certificates = @Certificate(format = PEM, configureHttpServer = true, configureKeystore = true, configureTruststore = true))
static RestService app = new RestService()
.setAutoStart(false)
.withProperty("quarkus.http.port", String.valueOf(COMMON_PORT_HTTP_HTTPS))
.withProperty("quarkus.http.ssl-port", String.valueOf(COMMON_PORT_HTTP_HTTPS));

@Test
void verifyAppBehaviourUsingSamePorts() {
assertThrows(AssertionError.class, () -> app.start(),
"Should fail because Both http and https servers started on port 50000");
String logs = app.getLogs().toString();
assertTrue(logs.contains("Both http and https servers started on port 50000"));
}

}
Loading