Skip to content

Commit

Permalink
token-2022: Fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Sep 14, 2023
1 parent 6803d68 commit c9f7ad3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions token/program-2022-test/tests/confidential_transfer_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,8 @@ async fn confidential_transfer_harvest_withheld_tokens_to_mint() {
.await
.unwrap();

// Refresh the blockhash since we're doing the same thing twice in a row
token.get_new_latest_blockhash().await.unwrap();
token
.confidential_transfer_harvest_withheld_tokens_to_mint(&[&bob_meta.token_account])
.await
Expand Down
2 changes: 2 additions & 0 deletions token/program-2022-test/tests/cpi_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ async fn test_cpi_guard_approve() {
.await
.unwrap();

// refresh the blockhash
token_obj.get_new_latest_blockhash().await.unwrap();
token_obj
.process_ixs(&[mk_approve(do_checked)], &[&alice])
.await
Expand Down
12 changes: 7 additions & 5 deletions token/program-2022-test/tests/token_metadata_emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ async fn success(start: Option<u64>, end: Option<u64>) {
if !check_buffer.is_empty() {
// pad the data if necessary
let mut return_data = vec![0; MAX_RETURN_DATA];
let simulation_return_data =
simulation.simulation_details.unwrap().return_data.unwrap();
assert_eq!(simulation_return_data.program_id, program_id);
return_data[..simulation_return_data.data.len()]
.copy_from_slice(&simulation_return_data.data);
if let Some(simulation_details) = simulation.simulation_details {
if let Some(simulation_return_data) = simulation_details.return_data {
assert_eq!(simulation_return_data.program_id, program_id);
return_data[..simulation_return_data.data.len()]
.copy_from_slice(&simulation_return_data.data);
}
}

assert_eq!(*check_buffer, return_data[..check_buffer.len()]);
// we're sure that we're getting the full data, so also compare the deserialized type
Expand Down

0 comments on commit c9f7ad3

Please sign in to comment.