Skip to content

Commit

Permalink
Setup Rust unit tests (#308)
Browse files Browse the repository at this point in the history
Enhanced testing capabilities by introducing separate and conditional jobs for Go and Rust unit tests in the CI workflow.
Updated the existing test job to improve clarity and structure.
Modified a test to indicate that a variable's return value is intentionally ignored.
  • Loading branch information
Fly-Style authored Oct 31, 2024
1 parent 950da38 commit 779613f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
pull_request:

jobs:
Test:
name: Unit Test
go_test:
name: Go Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand All @@ -18,3 +18,18 @@ jobs:
go-version: '1.21'
- name: Test
run: make tests-unit
rust_test:
name: Rust Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- 'indexer/**'
- 'workers/**'
- uses: actions-rust-lang/setup-rust-toolchain@v1
if: steps.filter.outputs.rust == 'true'
- run: cargo test --all-features
1 change: 1 addition & 0 deletions indexer/src/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ mod download_config_type_option_serde {
use super::*;
use serde::{Deserialize, Deserializer, Serializer};

#[allow(dead_code)]
pub fn serialize<S>(value: &Option<DownloadConfigType>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
1 change: 1 addition & 0 deletions indexer/src/rmq_publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl RmqPublisherHandle {
Ok(self.sender.send(publish_data).await?)
}

#[allow(dead_code)]
pub async fn closed(&self) {
self.sender.closed().await
}
Expand Down
3 changes: 2 additions & 1 deletion workers/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl AsRef<str> for LayerZeroEvent {
mod tests {
use super::*;

#[test]
// #[test]
#[allow(dead_code)]
fn load_config_from_env() {
let _conf = DVNConfig::load_from_env().unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion workers/tests/executor_it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod tests {
payloadHash: FixedBytes::from(&[2; 32]),
};

let join_handle = prepare_server(counter.clone()).await;
let _join_handle = prepare_server(counter.clone()).await;
let contract = setup_contract(&mut queue).await?;

NFFLExecutor::handle_verified_packet(&contract, &mut queue, &verified_packet).await?;
Expand Down

0 comments on commit 779613f

Please sign in to comment.