Skip to content

Commit 7e2aca3

Browse files
authored
Refactor and improve tests (#121)
- use Reserve, LendingMarket, Obligation types directly instead of TestReserve, TestLendingMarket, TestObligation - more helper functions - check account state after every successful program call - check _all_ token accounts and mint accounts after every successful program call
1 parent affb6e4 commit 7e2aca3

30 files changed

+5065
-6504
lines changed

.github/workflows/pull-request.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ jobs:
132132

133133
- name: Set env vars
134134
run: |
135-
source ci/rust-version.sh nightly
136-
echo "RUST_NIGHTLY=$rust_nightly" >> $GITHUB_ENV
135+
source ci/rust-version.sh
136+
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
137137
source ci/solana-version.sh
138138
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
139139
140140
- uses: actions-rs/toolchain@v1
141141
with:
142-
toolchain: ${{ env.RUST_NIGHTLY }}
142+
toolchain: ${{ env.RUST_STABLE }}
143143
override: true
144144
profile: minimal
145145

@@ -149,7 +149,7 @@ jobs:
149149
~/.cargo/registry
150150
~/.cargo/git
151151
# target # Removed due to build dependency caching conflicts
152-
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_NIGHTLY }}
152+
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE }}
153153

154154
- name: Install dependencies
155155
run: |
@@ -158,9 +158,9 @@ jobs:
158158
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
159159
160160
- name: run test coverage
161-
run: ./coverage.sh token-lending
161+
run: ./coverage.sh
162162

163163
- name: Codecov
164164
uses: codecov/codecov-action@v3.1.0
165165
with:
166-
file: target/cov/cobertura.xml
166+
directory: target/coverage/

Cargo.lock

Lines changed: 31 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci/cargo-test-bpf.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ run_dir=$(pwd)
3232
if [[ -d $run_dir/program ]]; then
3333
# Build/test just one BPF program
3434
cd $run_dir/program
35-
cargo +"$rust_stable" test-bpf -- --nocapture
35+
RUST_LOG="error" cargo +"$rust_stable" test-bpf -j 1 -- --nocapture
3636
else
3737
# Build/test all BPF programs
3838
for directory in $(ls -d $run_dir/*/); do
3939
cd $directory
40-
cargo +"$rust_stable" test-bpf -- --nocapture
40+
RUST_LOG="error" cargo +"$rust_stable" test-bpf -j 1 -- --nocapture
4141
done
4242
fi

ci/install-program-deps.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ cargo install honggfuzz --version=0.5.52 --force || true
1313
cargo +"$rust_stable" install grcov --force
1414

1515
cargo +"$rust_stable" build-bpf --version
16+
rustup component add llvm-tools-preview

ci/rust-version.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
if [[ -n $RUST_STABLE_VERSION ]]; then
1919
stable_version="$RUST_STABLE_VERSION"
2020
else
21-
stable_version=1.63.0
21+
stable_version=1.65.0
2222
fi
2323

2424
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
2525
nightly_version="$RUST_NIGHTLY_VERSION"
2626
else
27-
nightly_version=2022-01-30
27+
nightly_version=2022-04-01
2828
fi
2929

3030

0 commit comments

Comments
 (0)