Skip to content

Commit

Permalink
fix: CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
berzanorg committed Apr 30, 2024
1 parent 6676fa5 commit a0a0e45
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
Expand Down
37 changes: 24 additions & 13 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,63 @@ jobs:
token_contract:
name: Token Contract Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./token-contract
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
node-version: 20
cache: "npm"
- run: npm install --prefix token-contract
- run: npm test --prefix token-contract
- run: npm install
- run: npm test

bridge_contract:
name: Bridge Contract Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./bridge-contract
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
node-version: 20
cache: "npm"
- run: npm install --prefix bridge-contract
- run: npm test --prefix bridge-contract
- run: npm install
- run: npm test

rollup_contract:
name: Rollup Contract Tests
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./rollup-contract
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
node-version: 20
cache: "npm"
- run: npm install --prefix rollup-contract
- run: npm test --prefix rollup-contract
- run: npm install
- run: npm test

proof_generator:
name: Proof Generator Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./proof-generator
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
node-version: 20
cache: "npm"
- run: npm install --prefix proof-generator
- run: npm test --prefix proof-generator
- run: npm install
- run: npm test
8 changes: 4 additions & 4 deletions dynamic-queue/src/dynamic_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use tokio::fs::remove_file;
use tokio::fs::remove_dir_all;

#[derive(Debug, PartialEq)]
struct T {
Expand All @@ -395,7 +395,7 @@ mod tests {

let _ = DynamicQueue::<4, T>::new(dir).await?;

Ok(remove_file(dir).await?)
Ok(remove_dir_all(dir).await?)
}

#[tokio::test]
Expand Down Expand Up @@ -462,7 +462,7 @@ mod tests {
assert_eq!(queue.pop().await?, Some(T { num: i }));
}

Ok(remove_file(dir).await?)
Ok(remove_dir_all(dir).await?)
}

#[tokio::test]
Expand Down Expand Up @@ -541,6 +541,6 @@ mod tests {
let file_len = queue.file.metadata().await?.len();
assert_eq!(file_len, (12 + 3 + 2) * 4 + 8);

Ok(remove_file(dir).await?)
Ok(remove_dir_all(dir).await?)
}
}
8 changes: 4 additions & 4 deletions transactions-db/src/transactions_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl TransactionsDb {
#[cfg(test)]
mod tests {
use super::*;
use tokio::fs::remove_file;
use tokio::fs::remove_dir_all;

#[tokio::test]
async fn creates_tx_statuses_db_correctly() {
Expand All @@ -260,7 +260,7 @@ mod tests {
assert_eq!(settled_until, 0);
assert_eq!(merged_until, 0);

remove_file(dir).await.unwrap();
remove_dir_all(dir).await.unwrap();
}

#[tokio::test]
Expand Down Expand Up @@ -317,7 +317,7 @@ mod tests {
let tx_count = tx_db.get_tx_count().await.unwrap();
assert_eq!(tx_count, 9);

remove_file(dir).await.unwrap();
remove_dir_all(dir).await.unwrap();
}

#[tokio::test]
Expand Down Expand Up @@ -375,6 +375,6 @@ mod tests {
let tx_status = tx_db.get_status(9).await.unwrap();
assert_eq!(tx_status, TxStatus::Pending);

remove_file(dir).await.unwrap();
remove_dir_all(dir).await.unwrap();
}
}

0 comments on commit a0a0e45

Please sign in to comment.