Skip to content

Commit 36067a6

Browse files
authored
Make stale_price tests to run on all platforms (#41)
1 parent 04e574f commit 36067a6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pyth-sdk-solana/test-contract/tests/stale_price.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg(feature = "test-bpf")] // Only runs on bpf, where solana programs run
2-
31
use pyth_sdk_solana::state::{
42
AccountType,
53
PriceAccount,
@@ -44,9 +42,12 @@ async fn test_price_stale() {
4442
// (its ~1-5). As the check will be 5u - 100u ~= 1e18 > MAX_SLOT_DIFFERENCE. It can only
4543
// break when Solana slot in the test suite becomes between 100 and 100+MAX_SLOT_DIFFERENCE.
4644
price.agg.pub_slot = 100;
47-
test_instr_exec_ok(instruction::price_status_check(
48-
&price,
49-
PriceStatus::Unknown,
50-
))
51-
.await;
45+
46+
#[cfg(feature = "test-bpf")] // Only in BPF the clock check is performed
47+
let expected_status = PriceStatus::Unknown;
48+
49+
#[cfg(not(feature = "test-bpf"))]
50+
let expected_status = PriceStatus::Trading;
51+
52+
test_instr_exec_ok(instruction::price_status_check(&price, expected_status)).await;
5253
}

0 commit comments

Comments
 (0)