Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ jobs:
cargo test --workspace --exclude magnetar-driver --all-features --locked -- --nocapture
cargo test -p magnetar-driver --all-features --locked --lib -- --nocapture
cargo test -p magnetar-driver --all-features --locked --doc -- --nocapture
# An example's `#[cfg(test)]` module compiles only here: clippy's
# `--all-targets` checks examples as binaries, and otherwise only the
# nightly performance contracts step builds it (ADR-0113).
cargo test -p magnetar-driver --all-features --locked --examples -- --nocapture
paths=(crates/magnetar/tests/*.rs)
for path in "${paths[@]}"; do
target="${path##*/}"
Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ cargo doc -p magnetar-driver --no-deps --locked # also catches links to admin/m
cargo clippy -p magnetar-driver --no-default-features --lib --locked -- -D warnings
cargo clippy -p magnetar-driver --no-default-features --lib --profile test --no-deps --locked -- -D warnings
cargo test --workspace --all-features
# an example's `#[cfg(test)]` module — neither line above compiles it
cargo test -p magnetar-driver --all-features --locked --examples
# Moonpool seed sweep — catches seed-dependent flakiness in the
# deterministic-simulation suite. performance.yml also replays fixed
# seeds 1..32 plus open registry anchors nightly on main, without buggify
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ cargo clippy -p magnetar-driver --no-default-features --lib --locked -- -D warni
cargo clippy -p magnetar-driver --no-default-features --lib --profile test --no-deps --locked -- -D warnings
cargo build --workspace --no-default-features --features "$FEATURES"
cargo test --workspace --no-default-features --features "$FEATURES" --locked
# An example's `#[cfg(test)]` module: neither `--all-targets` clippy nor the
# workspace test run compiles it; only this line and the nightly performance run do.
cargo test -p magnetar-driver --no-default-features --features "$FEATURES" --locked --examples
cargo deny check
RUSTDOCFLAGS="-D warnings" \
cargo doc --workspace --no-default-features --features "$FEATURES" --no-deps --locked
Expand Down
6 changes: 0 additions & 6 deletions crates/magnetar/examples/performance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,6 @@ mod tests {
receipt.batch_index = 0;
delivered.batch_index = 0;
assert!(!marker_position_matches(receipt, delivered));
#[cfg(feature = "scalable-topics")]
{
receipt = delivered;
delivered.segment_id = Some(magnetar::proto::types::SegmentId(3));
assert!(!marker_position_matches(receipt, delivered));
}
}

#[test]
Expand Down
29 changes: 18 additions & 11 deletions crates/magnetar/tests/common/pulsar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,23 @@ impl Pulsar {
self.command_for(Role::Standalone)
}

/// The proxy's container command. A proxy is configured with
/// [`Self::config`] only, so any other setting panics here, before
/// [`Self::start_proxy`] creates a container.
pub fn proxy_command(&self) -> Vec<String> {
assert!(
self.env.is_empty()
&& self.pre_start.is_empty()
&& self.flags.is_empty()
&& !self.zookeeper
&& !self.advertise_container_address
&& self.admin_token.is_none()
&& self.binary_port == BROKER_BINARY_PORT,
"a proxy is configured with `config` only"
);
self.command_for(Role::Proxy)
}

fn command_for(&self, role: Role) -> Vec<String> {
let needs_shell = role == Role::Proxy
|| !self.config.is_empty()
Expand Down Expand Up @@ -475,18 +492,8 @@ impl Pulsar {
/// so it waits for the proxy's own `Started Pulsar Proxy at` line, which
/// 4.x and 5.x both print. Configure it with [`Self::config`] only.
pub async fn start_proxy(self) -> Result<RunningProxy, BoxError> {
assert!(
self.env.is_empty()
&& self.pre_start.is_empty()
&& self.flags.is_empty()
&& !self.zookeeper
&& !self.advertise_container_address
&& self.admin_token.is_none()
&& self.binary_port == BROKER_BINARY_PORT,
"a proxy is configured with `config` only"
);
let command = self.proxy_command();
let tag = self.broker.tag();
let command = self.command_for(Role::Proxy);
let container = GenericImage::new(image_repo(), tag.as_str().to_owned())
.with_exposed_port(ContainerPort::Tcp(BROKER_BINARY_PORT))
.with_wait_for(WaitFor::message_on_stdout("Started Pulsar Proxy at"))
Expand Down
7 changes: 3 additions & 4 deletions crates/magnetar/tests/pulsar_fixture_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,10 @@ mod executed {
}
}

#[tokio::test]
#[test]
#[should_panic(expected = "a proxy is configured with `config` only")]
async fn a_standalone_binary_port_is_refused_before_a_proxy_starts() {
fn a_standalone_binary_port_is_refused_before_a_proxy_starts() {
let _ = Pulsar::new(Broker::Default)
.binary_port(17321)
.start_proxy()
.await;
.proxy_command();
}
Loading