Skip to content

Commit 925fc93

Browse files
committed
test: [#1384,#1376] add comment to mock time
In order to be able to compare full events.
1 parent f5bdec5 commit 925fc93

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

  • packages
    • http-tracker-core/src/event
    • udp-tracker-server/src

packages/http-tracker-core/src/event/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,17 @@ pub mod test {
124124
) => {
125125
*connection == *expected_connection
126126
&& *info_hash == *expected_info_hash
127+
&& announcement.peer_id == expected_announcement.peer_id
127128
&& announcement.peer_addr == expected_announcement.peer_addr
129+
// Events can't be compared due to the `updated` field.
130+
// The `announcement.uploaded` contains the current time
131+
// when the test is executed.
132+
// todo: mock time
133+
//&& announcement.updated == expected_announcement.updated
134+
&& announcement.uploaded == expected_announcement.uploaded
135+
&& announcement.downloaded == expected_announcement.downloaded
136+
&& announcement.left == expected_announcement.left
137+
&& announcement.event == expected_announcement.event
128138
}
129139
_ => false,
130140
}

packages/udp-tracker-server/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,17 @@ pub(crate) mod tests {
711711
) => {
712712
*connection == *expected_connection
713713
&& *info_hash == *expected_info_hash
714+
&& announcement.peer_id == expected_announcement.peer_id
714715
&& announcement.peer_addr == expected_announcement.peer_addr
716+
// Events can't be compared due to the `updated` field.
717+
// The `announcement.uploaded` contains the current time
718+
// when the test is executed.
719+
// todo: mock time
720+
//&& announcement.updated == expected_announcement.updated
721+
&& announcement.uploaded == expected_announcement.uploaded
722+
&& announcement.downloaded == expected_announcement.downloaded
723+
&& announcement.left == expected_announcement.left
724+
&& announcement.event == expected_announcement.event
715725
}
716726
_ => false,
717727
}

0 commit comments

Comments
 (0)