Skip to content

Commit b3ad0af

Browse files
committed
test_harness - fix assertions with timestamp for Validator Messages
1 parent 2feeb3a commit b3ad0af

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

test_harness/src/lib.rs

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,20 +2188,44 @@ mod tests {
21882188
.get_last_approved(CAMPAIGN_2.channel.id())
21892189
.await
21902190
.expect(
2191-
"Should fetch Last Approved Response from Channel's FOllower (Who am I) from LEADER sentry",
2191+
"Should fetch Last Approved Response from Channel's Follower (Who am I) from LEADER sentry",
21922192
).last_approved.expect("Should have an ApproveState & NewState");
21932193

2194-
assert_eq!(
2195-
last_approve_state_leader.new_state.unwrap(),
2196-
last_approve_state_follower.new_state.unwrap(),
2197-
"The NewState Messages in Channel's Leader & Follower should be the same"
2198-
);
2194+
// compare NewState from Leader & Follower
2195+
// NOTE: The `received` timestamp can differ, so compare everything except `received`!
2196+
{
2197+
let leader = last_approve_state_leader.new_state.unwrap();
2198+
let follower = last_approve_state_follower.new_state.unwrap();
21992199

2200-
assert_eq!(
2201-
last_approve_state_leader.approve_state.unwrap(),
2202-
last_approve_state_follower.approve_state.unwrap(),
2203-
"The ApproveState Messages in Channel's Leader & Follower should be the same"
2204-
);
2200+
assert_eq!(
2201+
leader.msg,
2202+
follower.msg,
2203+
"The NewState Messages in Channel's Leader & Follower should be the same"
2204+
);
2205+
assert_eq!(
2206+
leader.from,
2207+
follower.from,
2208+
"The NewState Messages in Channel's Leader & Follower should have the same `from` address"
2209+
);
2210+
}
2211+
2212+
// compare ApproveState from Leader & Follower
2213+
// NOTE: The `received` timestamp can differ, so compare everything except `received`!
2214+
{
2215+
let leader = last_approve_state_leader.approve_state.unwrap();
2216+
let follower = last_approve_state_follower.approve_state.unwrap();
2217+
2218+
assert_eq!(
2219+
leader.msg,
2220+
follower.msg,
2221+
"The ApproveState Messages in Channel's Leader & Follower should be the same"
2222+
);
2223+
assert_eq!(
2224+
leader.from,
2225+
follower.from,
2226+
"The ApproveState Messages in Channel's Leader & Follower should have the same `from` address"
2227+
);
2228+
}
22052229
}
22062230
}
22072231

0 commit comments

Comments
 (0)