ryerraguntla commented on code in PR #4043:
URL: https://github.com/apache/iggy/pull/4043#discussion_r3968312475


##########
gateways/kafka/tests/bridge_iggy_integration_tests.rs:
##########
@@ -0,0 +1,435 @@
+// 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.
+
+//! Integration tests for `IggyBridge` against a real `iggy-server` process - 
not the
+//! `KafkaGateway` under test elsewhere in this suite. `#3533` acceptance 
criteria this file
+//! exercises directly: `ensure_stream_and_topic` idempotent on repeated 
calls, and the bridge
+//! module invoked from a real (non-unit) test rather than only compiled.
+
+use std::collections::HashMap;
+use std::fs::{File, OpenOptions};
+use std::path::PathBuf;
+use std::process::{Child, Command};
+use std::sync::OnceLock;
+use std::time::Duration;
+
+use iggy::prelude::{
+    AutoLogin, Client, Credentials, Identifier, IggyClient, IggyClientBuilder, 
IggyMessage,
+    MessageClient, Partitioning,
+};
+use secrecy::SecretString;
+use serial_test::serial;
+
+use iggy_gateway_kafka::bridge::{BridgeError, IggyBridge, IggyBridgeConfig, 
TopicMapping};
+
+/// First port of the local reservation band. `u16` has no room above the 
highest ephemeral
+/// ceiling in use (macOS: 49152-65535), so "clear of ephemeral" only leaves 
room below the
+/// lowest floor (Linux default: 32768) - picked here below 
`core/integration`'s own
+/// `port_reserver.rs` band too (20000 up to that floor), so a `bind(0)` call 
in an unrelated
+/// process, including that harness's own test servers, is never handed a port 
this band claims.
+const PORT_LOCK_BAND_START: u16 = 15000;

Review Comment:
   Fixed — it was was overclaiming. Replaced the hardcoded 15000..15199 band 
with port_reserver.rs's own approach: reads 
/proc/sys/net/ipv4/ip_local_port_range (ephemeral_range(), Linux default 
32768-60999 fallback
     where there's no /proc, e.g. macOS), then picks a band clear of it — below 
the floor by preference, above the ceiling when the floor leaves no room, 
panics loudly if neither side has room (mirrors
     port_reserver.rs's own "no degraded mode"). flock is still advisory as you 
said — the fix isn't making it exclusive, it's making sure the band it locks is 
actually outside the range an unrelated bind(0) could
     land in, on a box tuned 1024 65535 or otherwise.



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