Skip to content

Commit

Permalink
remove conductor_ prefix from tests, remove explicit sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFluffy committed Feb 4, 2025
1 parent 42ae864 commit c586b33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 39 deletions.
10 changes: 2 additions & 8 deletions crates/astria-conductor/tests/blackbox/firm_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ use futures::future::{
};
use serde_json::json;
use telemetry::metrics;
use tokio::time::{
sleep,
timeout,
};
use tokio::time::timeout;
use wiremock::{
matchers::{
body_partial_json,
Expand Down Expand Up @@ -546,7 +543,7 @@ async fn exits_on_celestia_chain_id_mismatch() {
/// satisfaction.
#[expect(clippy::too_many_lines, reason = "All lines reasonably necessary")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn conductor_restarts_after_reaching_stop_block_height() {
async fn restarts_after_reaching_stop_block_height() {
let test_conductor = spawn_conductor(CommitLevel::FirmOnly).await;

mount_get_genesis_info!(
Expand Down Expand Up @@ -635,9 +632,6 @@ async fn conductor_restarts_after_reaching_stop_block_height() {
commitment state twice within 1000ms",
);

// Wait for conductor to restart before performing the next set of mounts
sleep(Duration::from_millis(1000)).await;

// Mount new genesis info and commitment state with updated heights
mount_get_genesis_info!(
test_conductor,
Expand Down
28 changes: 7 additions & 21 deletions crates/astria-conductor/tests/blackbox/soft_and_firm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use futures::future::{
join,
join3,
};
use tokio::time::{
sleep,
timeout,
};
use tokio::time::timeout;

use crate::{
helpers::spawn_conductor,
Expand Down Expand Up @@ -466,7 +463,7 @@ async fn missing_block_is_fetched_for_updating_firm_commitment() {
reason = "all lines fairly necessary, and I don't think a test warrants a refactor"
)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn conductor_restarts_on_permission_denied() {
async fn restarts_on_permission_denied() {
let test_conductor = spawn_conductor(CommitLevel::SoftAndFirm).await;

mount_get_genesis_info!(
Expand Down Expand Up @@ -607,8 +604,7 @@ async fn conductor_restarts_on_permission_denied() {
/// arrive first.
/// 5. Mount `execute_block` and `update_commitment_state` for both soft and firm blocks at height 3
/// 6. Await satisfaction of the `execute_block` and `update_commitment_state` for the soft and firm
/// blocks at height 3 with a timeout of 1000ms. The test sleeps during this time, so that the
/// following mounts do not occur before the conductor restarts.
/// blocks at height 3 with a timeout of 1000ms.
/// 7. Mount new genesis info with a sequencer stop height of 10 and a rollup start block height of
/// 2, along with corresponding commitment state, reflecting that block 1 has already been
/// executed and the commitment state updated.
Expand All @@ -619,7 +615,7 @@ async fn conductor_restarts_on_permission_denied() {
reason = "All lines reasonably necessary for the thoroughness of this test"
)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn conductor_restarts_after_reaching_soft_stop_height_first() {
async fn restarts_after_reaching_soft_stop_height_first() {
let test_conductor = spawn_conductor(CommitLevel::SoftAndFirm).await;

mount_get_genesis_info!(
Expand Down Expand Up @@ -739,9 +735,6 @@ async fn conductor_restarts_after_reaching_soft_stop_height_first() {
.await
.expect("conductor should have updated the firm commitment state within 1000ms");

// Wait until conductor is restarted before performing next set of mounts
sleep(Duration::from_millis(1000)).await;

mount_get_genesis_info!(
test_conductor,
sequencer_start_height: 2,
Expand Down Expand Up @@ -836,8 +829,7 @@ async fn conductor_restarts_after_reaching_soft_stop_height_first() {
/// firm block will be received first.
/// 5. Mount `execute_block` and `update_commitment_state` for firm block at height 3.
/// 6. Await satisfaction of the `execute_block` and `update_commitment_state` for the firm block at
/// height 3 with a timeout of 1000ms. The test sleeps during this time, so that the following
/// mounts do not occur before the conductor restarts.
/// height 3 with a timeout of 1000ms.
/// 7. Mount new genesis info with a sequencer stop height of 10 and a rollup start block height of
/// 2, along with corresponding commitment state, reflecting that block 1 has already been
/// executed and the commitment state updated.
Expand All @@ -849,7 +841,7 @@ async fn conductor_restarts_after_reaching_soft_stop_height_first() {
reason = "All lines reasonably necessary for the thoroughness of this test"
)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn conductor_restarts_after_reaching_firm_stop_height_first() {
async fn restarts_after_reaching_firm_stop_height_first() {
let test_conductor = spawn_conductor(CommitLevel::SoftAndFirm).await;

mount_get_genesis_info!(
Expand Down Expand Up @@ -969,9 +961,6 @@ async fn conductor_restarts_after_reaching_firm_stop_height_first() {
.await
.expect("conductor should have updated the firm commitment state within 1000ms");

// Wait until conductor is restarted before performing next set of mounts
sleep(Duration::from_millis(1000)).await;

mount_get_genesis_info!(
test_conductor,
sequencer_start_height: 2,
Expand Down Expand Up @@ -1067,7 +1056,7 @@ async fn conductor_restarts_after_reaching_firm_stop_height_first() {
/// `conductor_restarts_after_reaching_soft_stop_height_first`.
/// 7. Allow ample time for the conductor to potentially restart erroneously.
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn conductor_stops_at_stop_height() {
async fn stops_at_stop_height() {
let test_conductor = spawn_conductor(CommitLevel::SoftAndFirm).await;

mount_get_genesis_info!(
Expand Down Expand Up @@ -1174,7 +1163,4 @@ async fn conductor_stops_at_stop_height() {
)
.await
.expect("conductor should have updated the firm commitment state within 1000ms");

// Allow time for a potential erroneous restart
sleep(Duration::from_millis(1000)).await;
}
13 changes: 3 additions & 10 deletions crates/astria-conductor/tests/blackbox/soft_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use futures::future::{
join4,
};
use telemetry::metrics;
use tokio::time::{
sleep,
timeout,
};
use tokio::time::timeout;

use crate::{
commitment_state,
Expand Down Expand Up @@ -475,8 +472,7 @@ async fn exits_on_sequencer_chain_id_mismatch() {
/// so that the same information is not retrieved after restarting.
/// 2. Mount sequencer genesis, ABCI info, and sequencer blocks for heights 3 and 4.
/// 3. Mount `execute_block` and `update_commitment_state` mocks for the soft block at height 3,
/// expecting only 1 call and timing out after 1000ms. During this time, the test sleeps so that
/// the following mounts are not performed before the conductor restarts.
/// expecting only 1 call and timing out after 1000ms.
/// 4. Mount updated commitment state and genesis info with a stop height of 10 (more than high
/// enough) and a rollup start block height of 2, reflecting that the first block has already
/// been executed.
Expand All @@ -487,7 +483,7 @@ async fn exits_on_sequencer_chain_id_mismatch() {
reason = "All lines reasonably necessary for the thoroughness of this test"
)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn conductor_restarts_after_reaching_stop_block_height() {
async fn restarts_after_reaching_stop_block_height() {
let test_conductor = spawn_conductor(CommitLevel::SoftOnly).await;

mount_get_genesis_info!(
Expand Down Expand Up @@ -571,9 +567,6 @@ async fn conductor_restarts_after_reaching_stop_block_height() {
commitment state within 1000ms",
);

// Wait until conductor is restarted before performing next set of mounts
sleep(Duration::from_millis(1000)).await;

mount_get_genesis_info!(
test_conductor,
sequencer_start_height: 2,
Expand Down

0 comments on commit c586b33

Please sign in to comment.