You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by gk...@apache.org on 2026/05/14 07:57:24 UTC
(iggy) 05/08: temp
This is an automated email from the ASF dual-hosted git repository.
numinnex pushed a commit to branch integration_tests
in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 49053a08eec3b4a913a615efb02234cc1b571f6e
Author: numinex <g....@gmail.com>
AuthorDate: Thu May 7 15:16:37 2026 +0200
temp
---
core/harness_derive/src/attrs.rs | 18 +++++++++++++++
core/harness_derive/src/codegen.rs | 4 ++++
core/integration/src/harness/config/server.rs | 2 ++
core/integration/src/harness/handle/server.rs | 27 ++++++++++++++++++----
.../tests/sdk/{mod.rs => hello_world.rs} | 12 +++++++++-
core/integration/tests/sdk/mod.rs | 1 +
6 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/core/harness_derive/src/attrs.rs b/core/harness_derive/src/attrs.rs
index 7d8e68f7d..9c1018f31 100644
--- a/core/harness_derive/src/attrs.rs
+++ b/core/harness_derive/src/attrs.rs
@@ -182,6 +182,9 @@ pub struct ServerAttrs {
/// Dynamic config overrides using dot-notation paths.
pub config_overrides: Vec<ConfigOverride>,
+ /// Executable path or bare cargo binary name to launch for the test server.
+ pub executable_path: Option<String>,
+
/// Path to a TOML config file for the server.
pub config_path: Option<String>,
@@ -440,6 +443,11 @@ fn parse_server_attrs(input: ParseStream) -> syn::Result<ServerAttrs> {
let lit: LitStr = input.parse()?;
server.config_path = Some(lit.value());
}
+ "executable_path" => {
+ input.parse::<Token![=]>()?;
+ let lit: LitStr = input.parse()?;
+ server.executable_path = Some(lit.value());
+ }
_ => {
input.parse::<Token![=]>()?;
let value = parse_config_value(input)?;
@@ -627,6 +635,16 @@ mod tests {
assert!(matches!(&segment_size.value, ConfigValue::Static(s) if s == "1MiB"));
}
+ #[test]
+ fn parse_server_executable_path() {
+ let attrs: IggyTestAttrs =
+ syn::parse_quote!(server(executable_path = "iggy-server-ng"));
+ assert_eq!(
+ attrs.server.executable_path.as_deref(),
+ Some("iggy-server-ng")
+ );
+ }
+
#[test]
fn parse_server_matrix() {
let attrs: IggyTestAttrs = syn::parse_quote!(server(segment.size = ["512B", "1MiB"]));
diff --git a/core/harness_derive/src/codegen.rs b/core/harness_derive/src/codegen.rs
index 7f6e23a5e..4acbd8c25 100644
--- a/core/harness_derive/src/codegen.rs
+++ b/core/harness_derive/src/codegen.rs
@@ -424,6 +424,10 @@ fn generate_harness_setup(
// Always add extra_envs (may be empty)
server_builder_calls.push(quote!(.extra_envs(__extra_envs)));
+ if let Some(ref executable_path) = attrs.server.executable_path {
+ server_builder_calls.push(quote!(.executable_path(#executable_path)));
+ }
+
// If a config_path is specified, inject IGGY_CONFIG_PATH into extra_envs
let config_path_setup = if let Some(ref config_path) = attrs.server.config_path {
quote! {
diff --git a/core/integration/src/harness/config/server.rs b/core/integration/src/harness/config/server.rs
index 7925e12e9..e5ffdb9b7 100644
--- a/core/integration/src/harness/config/server.rs
+++ b/core/integration/src/harness/config/server.rs
@@ -56,10 +56,12 @@ mod tests {
fn test_server_config_builder() {
let config = TestServerConfig::builder()
.quic_enabled(false)
+ .executable_path("iggy-server-ng")
.extra_envs(HashMap::from([("FOO".to_string(), "BAR".to_string())]))
.build();
assert!(!config.quic_enabled);
+ assert_eq!(config.executable_path.as_deref(), Some("iggy-server-ng"));
assert_eq!(config.extra_envs.get("FOO"), Some(&"BAR".to_string()));
}
diff --git a/core/integration/src/harness/handle/server.rs b/core/integration/src/harness/handle/server.rs
index 9752da94d..47839b84b 100644
--- a/core/integration/src/harness/handle/server.rs
+++ b/core/integration/src/harness/handle/server.rs
@@ -93,6 +93,14 @@ impl std::fmt::Debug for ServerHandle {
}
impl ServerHandle {
+ fn launched_binary(&self) -> String {
+ if let Some(path) = &self.config.executable_path {
+ path.clone()
+ } else {
+ "iggy-server".to_string()
+ }
+ }
+
pub fn tcp_addr(&self) -> Option<SocketAddr> {
self.addrs.tcp
}
@@ -402,7 +410,7 @@ impl ServerHandle {
{
let (stdout, stderr) = self.collect_logs();
return Err(TestBinaryError::ProcessCrashed {
- binary: "iggy-server".to_string(),
+ binary: self.launched_binary(),
exit_code: status.code(),
stdout,
stderr,
@@ -427,7 +435,7 @@ impl ServerHandle {
}
Err(TestBinaryError::StartupTimeout {
- binary: "iggy-server".to_string(),
+ binary: self.launched_binary(),
timeout_secs: MAX_PORT_WAIT_DURATION_S,
})
}
@@ -776,11 +784,20 @@ impl TestBinary for ServerHandle {
}
#[allow(deprecated)]
+ let launched_binary = self.launched_binary();
let mut command = if let Some(ref path) = self.config.executable_path {
- Command::new(path)
+ let path_ref = Path::new(path);
+ if path_ref.components().count() == 1 && !path_ref.exists() {
+ Command::cargo_bin(path).map_err(|e| TestBinaryError::ProcessSpawn {
+ binary: launched_binary.clone(),
+ source: std::io::Error::other(e.to_string()),
+ })?
+ } else {
+ Command::new(path)
+ }
} else {
Command::cargo_bin("iggy-server").map_err(|e| TestBinaryError::ProcessSpawn {
- binary: "iggy-server".to_string(),
+ binary: launched_binary.clone(),
source: std::io::Error::other(e.to_string()),
})?
};
@@ -829,7 +846,7 @@ impl TestBinary for ServerHandle {
}
let child = command.spawn().map_err(|e| TestBinaryError::ProcessSpawn {
- binary: "iggy-server".to_string(),
+ binary: launched_binary,
source: e,
})?;
self.child_handle = Some(child);
diff --git a/core/integration/tests/sdk/mod.rs b/core/integration/tests/sdk/hello_world.rs
similarity index 72%
copy from core/integration/tests/sdk/mod.rs
copy to core/integration/tests/sdk/hello_world.rs
index 6d94bfa61..42d5a25ba 100644
--- a/core/integration/tests/sdk/mod.rs
+++ b/core/integration/tests/sdk/hello_world.rs
@@ -16,4 +16,14 @@
* under the License.
*/
-mod producer;
+use iggy::prelude::*;
+use integration::iggy_harness;
+
+#[iggy_harness(
+ test_client_transport = [Tcp, Quic, WebSocket],
+ server(executable_path = "iggy-server-ng")
+)]
+async fn hello_world(harness: &TestHarness) {
+ let client = harness.root_client().await.unwrap();
+ client.ping().await.unwrap();
+}
diff --git a/core/integration/tests/sdk/mod.rs b/core/integration/tests/sdk/mod.rs
index 6d94bfa61..05acd11c6 100644
--- a/core/integration/tests/sdk/mod.rs
+++ b/core/integration/tests/sdk/mod.rs
@@ -16,4 +16,5 @@
* under the License.
*/
+mod hello_world;
mod producer;