Skip to content

Conversation

xDarksome
Copy link
Member

Description

  • creates testing crate and move most of the integration tests there
  • makes testing to be a lib that can be used elsewhere (relay)
  • removes no longer relevant integration tests from other crates
  • replaces ports with sockets in node/database configs, to finally fix "Address already in use" errors in integration tests once and for all

How Has This Been Tested?

Integration

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@Copilot Copilot AI review requested due to automatic review settings September 1, 2025 19:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR creates a dedicated testing crate to consolidate integration tests across the codebase and improves test reliability by switching from fixed ports to dynamic socket allocation. The changes enable the testing infrastructure to be reused elsewhere (relay) while fixing "Address already in use" errors.

  • Refactors the RPC server API to use Socket objects instead of port numbers for better resource management
  • Centralizes integration test infrastructure in a new testing crate with reusable test cluster functionality
  • Removes redundant integration tests from individual crates now covered by the central test suite

Reviewed Changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/testing/ New crate providing reusable test cluster infrastructure with load simulation capabilities
crates/rpc/src/server.rs Refactors server config to use Socket objects instead of ports for better resource management
crates/node/src/lib.rs Updates node configuration to use new socket-based RPC server API
crates/db/src/lib.rs Updates database configuration to use new socket-based RPC server API
crates/*/tests/integration.rs Removes individual integration tests now consolidated in testing crate
.github/workflows/ci.yaml Updates CI to run integration tests from new testing crate

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +116 to +117
pub fn new_low_priority(port: u16) -> io::Result<Self> {
Self::new(port, transport::Priority::High)
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new_low_priority method incorrectly passes Priority::High instead of Priority::Low to the new method.

Suggested change
pub fn new_low_priority(port: u16) -> io::Result<Self> {
Self::new(port, transport::Priority::High)
Self::new(port, transport::Priority::Low)

Copilot uses AI. Check for mistakes.


cluster.redeploy_all_offline_nodes().await;

tokio::time::sleep(Duration::from_secs(3600)).await;
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test includes a 1-hour sleep which makes tests extremely slow. Consider reducing this duration or making it configurable for testing environments.

Copilot uses AI. Check for mistakes.

async fn set_exp(&self, key: u32, exp: RecordExpiration) {
self.client
.set_exp(self.namespace, expand_key(key), exp)
.pipe(|fut| self.stats.record(fut, "get_exp"))
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stats recording for set_exp operation is incorrectly labeled as 'get_exp' instead of 'set_exp'.

Suggested change
.pipe(|fut| self.stats.record(fut, "get_exp"))
.pipe(|fut| self.stats.record(fut, "set_exp"))

Copilot uses AI. Check for mistakes.

let id = cfg.id();

tracing::info!(ports = ?[cfg.primary_rpc_server_port, cfg.secondary_rpc_server_port], %id, "starting database server");
tracing::info!(ports = ?[cfg.primary_rpc_server_socket.port(), cfg.secondary_rpc_server_socket.port()], %id, "starting database server");
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logging statement calls .port() method which returns io::Result<u16>, but the debug formatting expects direct values. This will log Result objects instead of port numbers.

Suggested change
tracing::info!(ports = ?[cfg.primary_rpc_server_socket.port(), cfg.secondary_rpc_server_socket.port()], %id, "starting database server");
tracing::info!(
ports = ?[
cfg.primary_rpc_server_socket.port().unwrap_or(0),
cfg.secondary_rpc_server_socket.port().unwrap_or(0)
],
%id,
"starting database server"
);

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants