gnodet-bot commented on code in PR #28360:
URL: https://github.com/apache/camel/pull/28360#discussion_r4375506837


##########
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");
+
+        assertDoesNotThrow(() -> connect(InetAddress.getByName("127.0.0.1")));
+        assertThrows(IOException.class, () -> connect(other));

Review Comment:
   ⚠️ **Test still skipped in minimal CI containers** (still unaddressed). 
`findNonLoopbackAddress()` returns `null` in environments without a 
non-loopback interface, causing `assumeTrue` to silently skip the entire test. 
On Linux, TCP binding to `127.0.0.1` rejects connections to `127.0.0.2` even 
though both are in `127.0.0.0/8`. Use `127.0.0.2` directly — no assumptions 
needed, test runs unconditionally:
   
   ```suggestion
           assertDoesNotThrow(() -> 
connect(InetAddress.getByName("127.0.0.1")));
           assertThrows(IOException.class, () -> 
connect(InetAddress.getByName("127.0.0.2")));
   ```
   
   You can also remove `findNonLoopbackAddress()`, the 
`NetworkInterface`/`Inet4Address` imports, and the `assumeTrue` import.



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -3573,3 +3573,12 @@ producer only, and the catalog now describes the body 
that the webhook route get
 the YAML DSL validator and the Endpoint DSL, now accept a whatsapp endpoint as 
a consumer, and the Endpoint DSL builder
 of whatsapp gets the consumer options `bridgeErrorHandler`, `exceptionHandler` 
and `exchangePattern`. A whatsapp
 endpoint used directly in `from` still fails at startup: wrap it with the 
webhook component, as before.
+
+=== 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 (still present after rebase).
   
   ```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]

Reply via email to