Skip to content

Commit

Permalink
Fix #48: use a single server in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro authored and valdar committed May 21, 2019
1 parent 78ef402 commit 41aa261
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,15 @@ public void configure() throws Exception {

@Test
void testProduceDefaultEventType() throws Exception {
final int port1 = AvailablePortFinder.getNextAvailable();
final int port2 = AvailablePortFinder.getNextAvailable();
final int port = AvailablePortFinder.getNextAvailable();

KnativeEnvironment env = new KnativeEnvironment(Arrays.asList(
new KnativeEnvironment.KnativeServiceDefinition(
Knative.Type.endpoint,
Knative.Protocol.http,
"myEndpoint",
"localhost",
port1,
port,
KnativeSupport.mapOf(
Knative.SERVICE_META_PATH, "/",
Knative.CONTENT_TYPE, "text/plain"
Expand All @@ -136,9 +135,9 @@ void testProduceDefaultEventType() throws Exception {
Knative.Protocol.http,
"myEndpoint2",
"localhost",
port2,
port,
KnativeSupport.mapOf(
Knative.SERVICE_META_PATH, "/",
Knative.SERVICE_META_PATH, "/2",
Knative.CONTENT_TYPE, "text/plain"
))
));
Expand All @@ -156,10 +155,10 @@ public void configure() throws Exception {
from("direct:source2")
.to("knative:endpoint/myEndpoint2?cloudEventsType=my.type");

fromF("netty4-http:http://localhost:%d/", port1)
fromF("netty4-http:http://localhost:%d/", port)
.to("mock:ce");

fromF("netty4-http:http://localhost:%d/", port2)
fromF("netty4-http:http://localhost:%d/2", port)
.to("mock:ce2");
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,15 @@ public void configure() throws Exception {

@Test
void testProduceDefaultEventType() throws Exception {
final int port1 = AvailablePortFinder.getNextAvailable();
final int port2 = AvailablePortFinder.getNextAvailable();
final int port = AvailablePortFinder.getNextAvailable();

KnativeEnvironment env = new KnativeEnvironment(Arrays.asList(
new KnativeEnvironment.KnativeServiceDefinition(
Knative.Type.endpoint,
Knative.Protocol.http,
"myEndpoint",
"localhost",
port1,
port,
KnativeSupport.mapOf(
Knative.SERVICE_META_PATH, "/",
Knative.CONTENT_TYPE, "text/plain"
Expand All @@ -136,9 +135,9 @@ void testProduceDefaultEventType() throws Exception {
Knative.Protocol.http,
"myEndpoint2",
"localhost",
port2,
port,
KnativeSupport.mapOf(
Knative.SERVICE_META_PATH, "/",
Knative.SERVICE_META_PATH, "/2",
Knative.CONTENT_TYPE, "text/plain"
))
));
Expand All @@ -156,10 +155,10 @@ public void configure() throws Exception {
from("direct:source2")
.to("knative:endpoint/myEndpoint2?cloudEventsType=my.type");

fromF("netty4-http:http://localhost:%d/", port1)
fromF("netty4-http:http://localhost:%d/", port)
.to("mock:ce");

fromF("netty4-http:http://localhost:%d/", port2)
fromF("netty4-http:http://localhost:%d/2", port)
.to("mock:ce2");
}
});
Expand Down

0 comments on commit 41aa261

Please sign in to comment.