Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-flaky' into 'master'

test: Improve error message in //rs/tests/execution:system_api_security_test

Improves error message so we can understand the flakyness of system test //rs/tests/execution:system_api_security_test. EXC-1653 

See merge request dfinity-lab/public/ic!20158
  • Loading branch information
dragoljub-duric committed Jul 1, 2024
2 parents 9cad817 + c7785f0 commit 15e3a74
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rs/tests/src/execution/system_api_security_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ async fn tests_for_illegal_data_buffer_access(agent: &ic_agent::Agent, canister_
.call()
.await;
let containing_str = "violated contract: ic0.msg_arg_data_copy heap: src=65536 + length=10 exceeds the slice size=65536";
assert!(
matches!(
ret_val,
Err(AgentError::UncertifiedReject(RejectResponse {reject_message, .. })) if reject_message.contains(containing_str)
),
"Should return error if input data is copied to out of bound internal buffer"
);

match ret_val {
Err(AgentError::UncertifiedReject(RejectResponse { reject_message, reject_code, error_code})) => {
assert!(reject_message.contains(containing_str), "Should return error if input data is copied to out of bound internal buffer. Instead, it returns unexpected message: {}.", reject_message);
assert_eq!(reject_code, ic_agent::agent::RejectCode::CanisterError);
assert_eq!(error_code, Some("IC0504".into()));
}
_ => panic!("Should return error if input data is copied to out of bound internal buffer. Instead, it returns unexpected reply: {:?}.", ret_val)
};

// Calls msg caller with correct size = 29 bytes
let ret_val = agent
Expand Down

0 comments on commit 15e3a74

Please sign in to comment.