gnodet-bot commented on code in PR #28360: URL: https://github.com/apache/camel/pull/28360#discussion_r4367124747
########## components/camel-avro-rpc/camel-avro-rpc-component/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerHostTest.java: ########## @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.avro; + +import java.io.IOException; +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.NetworkInterface; +import java.net.Socket; +import java.net.SocketException; + +import org.apache.camel.builder.RouteBuilder; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** + * The http consumer listens on the host of the endpoint, as the netty consumer does. + */ +public class AvroHttpConsumerHostTest extends AvroTestSupport { + + @Override + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + @Override + public void configure() { + from("avro:http:127.0.0.1:" + avroPort + + "/getName?protocolClassName=org.apache.camel.avro.test.TestReflection") + .setBody(constant("Camel")); + } + }; + } + + @Test + public void testListensOnConfiguredHostOnly() throws Exception { + InetAddress other = findNonLoopbackAddress(); + assumeTrue(other != null, "No non-loopback IPv4 address available"); Review Comment: ⚠️ **Test may be silently skipped in CI** — `findNonLoopbackAddress()` returns `null` in environments with only a loopback interface (minimal containers, some CI setups), causing `assumeTrue` to skip the test entirely. On Linux, binding to `127.0.0.1` *does* reject connections to `127.0.0.2` (verified — both are in `127.0.0.0/8` but TCP binding is address-specific). Use `127.0.0.2` as the "other" address and remove the `assumeTrue` guard: ```suggestion assertDoesNotThrow(() -> connect(InetAddress.getByName("127.0.0.1"))); assertThrows(IOException.class, () -> connect(InetAddress.getByName("127.0.0.2"))); ``` This lets the test run unconditionally on any Linux host and removes the `findNonLoopbackAddress()` helper and `assumeTrue` import. ########## docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc: ########## @@ -2661,3 +2661,12 @@ Node producer creates it, from the options of the Edge Node endpoint (`deviceIds Device route that starts before the Edge Node route, or while it is stopped, therefore no longer fails with a `NullPointerException` when the Device URI has no `deviceIds`. Sending to a Device endpoint while no producer of its Edge Node endpoint is started now fails the exchange with an `IllegalStateException`; before, the data was dropped. + +=== camel-avro-rpc - the http consumer listens on the host of the endpoint + +The `avro:http` consumer now uses the host of the endpoint URI (`avro:http:[host]:[port]`) for its HTTP server, as the `avro:netty` consumer does. Review Comment: Trailing whitespace after the period. ```suggestion The `avro:http` consumer now uses the host of the endpoint URI (`avro:http:[host]:[port]`) for its HTTP server, as the `avro:netty` consumer does. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
