Skip to content

Commit

Permalink
test(consensus): fix foreign_block_distribution test
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Mar 6, 2024
1 parent 0deb6cd commit 97f94af
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -26,7 +26,7 @@ env:
jobs:
fmt:
name: fmt
runs-on: [self-hosted, ubuntu-high-cpu]
runs-on: [ self-hosted, ubuntu-high-cpu ]

steps:
- name: checkout
Expand All @@ -50,7 +50,7 @@ jobs:
run: cargo +${{ env.nightly_toolchain }} fmt --all -- --check
prettier:
name: prettier
runs-on: [self-hosted, ubuntu-high-cpu]
runs-on: [ self-hosted, ubuntu-high-cpu ]

steps:
- name: checkout
Expand All @@ -66,7 +66,7 @@ jobs:
clippy:
name: clippy
runs-on: [self-hosted, ubuntu-high-cpu]
runs-on: [ self-hosted, ubuntu-high-cpu ]

steps:
- name: checkout
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
build:
name: check nightly
runs-on: [self-hosted, ubuntu-high-cpu]
runs-on: [ self-hosted, ubuntu-high-cpu ]

steps:
- name: checkout
Expand All @@ -147,7 +147,7 @@ jobs:

build-stable:
name: check stable
runs-on: [self-hosted, ubuntu-high-cpu]
runs-on: [ self-hosted, ubuntu-high-cpu ]

steps:
- name: checkout
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:

test:
name: test
runs-on: [self-hosted, ubuntu-high-cpu]
runs-on: [ self-hosted, ubuntu-high-cpu ]

steps:
- name: checkout
Expand Down Expand Up @@ -226,6 +226,14 @@ jobs:
- name: cargo test
run: cargo nextest run --all-features --release -E "not package(integration_tests)" --profile ci

# TODO: remove
- name: upload test result artifact
uses: actions/upload-artifact@v4 # upload test results as artifact
if: success() || failure()
with:
name: cucumber-test-results
path: ${{ github.workspace }}/data/test1.db

- name: upload artifact
uses: actions/upload-artifact@v4 # upload test results as artifact
if: success() || failure()
Expand Down
3 changes: 2 additions & 1 deletion dan_layer/consensus_tests/src/consensus.rs
Expand Up @@ -408,9 +408,10 @@ async fn leader_failure_node_goes_down() {

#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn foreign_block_distribution() {
setup_logger();
crate::support::logging::setup_logger_ci();
let mut test = Test::builder()
.with_test_timeout(Duration::from_secs(60))
.debug_sql("./data/test{}.db")
.with_message_filter(Box::new(move |from: &TestAddress, to: &TestAddress, _| {
match from.0.as_str() {
// We filter our message from each leader to the foreign committees. So we will rely on other members of
Expand Down
22 changes: 22 additions & 0 deletions dan_layer/consensus_tests/src/support/logging.rs
Expand Up @@ -25,3 +25,25 @@ pub fn setup_logger() {
// Apply globally
.apply();
}

// TODO: tmp remove
pub fn setup_logger_ci() {
let _ignore = fern::Dispatch::new()
// Perform allocation-free log formatting
.format(|out, message, record| {
out.finish(format_args!(
"{} [{}] {} {}",
humantime::format_rfc3339(std::time::SystemTime::now()),
record.target().strip_prefix("tari::dan::consensus::hotstuff::").unwrap_or(record.target()),
record.level(),
message
))
})
// Add blanket level filter -
.level(log::LevelFilter::Debug)
// Output to stdout, files, and other Dispatch configurations
.chain(std::io::stdout())
// .chain(fern::log_file("output.log").unwrap())
// Apply globally
.apply();
}

0 comments on commit 97f94af

Please sign in to comment.