Nick Mathewson
615e2ed31a
Split mocking parts of rtcompat into new rtmock crate.
...
Since these parts are testing-only, let's take steps to make sure we
don't ship them in production by accident.
2021-05-03 09:10:33 -04:00
Nick Mathewson
098cd61409
bump to latest async_io
2021-05-03 08:42:08 -04:00
Nick Mathewson
45c1ee1720
Much-improved tests for tor_chanmgr::builder
...
Now that we have MockNetRuntime and MockSleepRuntime, we can use
them to test a channel-builder by replaying the contents of a TLS
stream that it will accept.
2021-04-30 13:50:22 -04:00
Nick Mathewson
c6b54086a8
Make `now` an argument when verifying a channel.
...
It turns out that we want to take `now` from the Runtime, to make
higher level code testable.
2021-04-30 13:46:54 -04:00
Nick Mathewson
d89923ef19
note a small divergence in circuit id probing behavior.
2021-04-29 16:57:06 -04:00
Nick Mathewson
c372671b5a
Note a limitation in MockSleepProvider::advance
2021-04-28 13:47:01 -04:00
Nick Mathewson
64e32b8199
Remove most pin_project usage in tor_rtcompat.
2021-04-28 11:51:59 -04:00
Nick Mathewson
87a03d01e5
Remove pin_project usage in tor-proto.
...
Turns out we didn't need it.
2021-04-28 11:31:41 -04:00
Nick Mathewson
95671bd71d
Define a runtime wrapper to override the network.
2021-04-28 11:08:37 -04:00
Nick Mathewson
d3380877cc
Add a mock TLS provider.
2021-04-28 10:00:43 -04:00
Nick Mathewson
202096e98a
Add a MockNetwork structure for testing.
...
This isn't a shadow replacement: it's just a testing fixture that we
can use to try out code that wants to connect and/or listen.
2021-04-28 08:51:49 -04:00
Nick Mathewson
94c93c9121
Add some more clippy warnings to our list.
2021-04-27 14:51:04 -04:00
Nick Mathewson
2e3780affb
Enforce (and obey) clippy lints about exhaustive enums, structs.
...
These lints force us to declare our exported enums and
exhaustive-looking structs as non-exhaustive (so that we can add to
them in the future without breaking our API) or to explicitly
disable the warning for a given enum/struct (to say that we _intend_
for additions to be a breaking change).
2021-04-27 14:17:49 -04:00
Nick Mathewson
4306a28ddd
cargo fix --edition-idioms
2021-04-26 11:11:05 -04:00
Nick Mathewson
adefe60f60
upgrade httparse and zeroize
2021-04-25 12:39:35 -04:00
Nick Mathewson
27097c24c4
Small doc fix.
2021-04-24 11:01:55 -04:00
Nick Mathewson
ddd7ce0074
Merge branch 'chanmgr_refactor_and_test'
...
This is an apparent test coverage reduction in chanmgr, but that's only
apparent: it actually throws away a lot of untested code that was
previously hidden.
2021-04-23 12:58:00 -04:00
Nick Mathewson
579767f670
Another test in ChanMgr, for TargetInfo.
2021-04-23 12:57:45 -04:00
Nick Mathewson
12c45882f0
Refactor and simplify ChanMgr to use AbstractChanMgr.
2021-04-23 12:57:45 -04:00
Nick Mathewson
8c75da128a
Full documentations on the new parts of ChanMgr.
2021-04-23 12:57:45 -04:00
Nick Mathewson
e3db6678f6
Start on tests for reactored ChanMsg.
2021-04-23 12:57:45 -04:00
Nick Mathewson
68dc2f56ce
Begin refactoring ChanMgr to have better separation of concerns
...
Additionally:
Use futures::future::Shared instead of event_listener.
2021-04-22 17:40:47 -04:00
Nick Mathewson
acc4e09d60
Define a helper for replacing the sleep functionality of a runtime.
2021-04-22 17:05:37 -04:00
Nick Mathewson
0d0cfbc874
Stop using anyhow in tor_chanmgr.
...
It seemed like a good idea at first, but we need to be able to
tell the difference between these error types more easily.
2021-04-22 13:37:54 -04:00
Nick Mathewson
2e34a53f9b
Add a yield_now() call to MockSleepProvider::advance()
...
This is almost always what we want for testing: the task that is
advancing time wants to give the other tasks a chance to run.
Doing this turns MockSleepProvider::advance() into an async
function.
2021-04-21 14:05:49 -04:00
Nick Mathewson
b40a1edc54
tor_rtcompat: add a yield_now() function.
2021-04-21 13:48:18 -04:00
Nick Mathewson
4b0f3f6a35
More tests in tor-config
2021-04-21 10:59:28 -04:00
Nick Mathewson
951ea280c8
Only list the supported encodings in the `Accept-Encoding` header
...
Closes #113
2021-04-21 10:04:22 -04:00
Nick Mathewson
03f25bd2bc
Use stream_pair() to write a test for tor_dirclient::download
2021-04-21 09:04:27 -04:00
Nick Mathewson
d19ed533d2
Add a "socketpair"-style linked-reader/writer implementation for testing
2021-04-21 08:40:50 -04:00
Nick Mathewson
b00ff9f110
Make zstd and xz compression optional, but on-by-default.
2021-04-21 08:37:53 -04:00
Nick Mathewson
f6ca37cbe1
Disable a test on OSX; see arti#111
2021-04-20 15:40:36 -04:00
Nick Mathewson
572565bce2
Test for tor_dirclient::read_headers
2021-04-20 14:52:58 -04:00
Nick Mathewson
68ce1da4b0
Tests for tor_dirclient::read_and_decompress
2021-04-20 14:33:09 -04:00
Nick Mathewson
8007d719d9
Test for tor_dirclient::read_until_limited()
2021-04-20 13:51:47 -04:00
Nick Mathewson
50978dc7d2
tor-dirclient: more requests.rs tests
2021-04-20 13:32:20 -04:00
Nick Mathewson
3fc66306c5
Tests for sleep_until_wallclock.
2021-04-20 09:34:34 -04:00
Nick Mathewson
4a761f55ea
A little more testing for tor_rtcompat::mock::time.
2021-04-20 08:26:41 -04:00
Nick Mathewson
a910627e92
Add support for simulating the passage of time.
2021-04-19 20:13:12 -04:00
Nick Mathewson
5f850fad1f
Add "now" functions to SleepProvider.
2021-04-19 20:03:27 -04:00
Nick Mathewson
ec6dc417b9
rtcompat: remove an unused conversion function.
2021-04-19 10:28:41 -04:00
Nick Mathewson
fe22c329c6
Simple unit tests for tor_rtcompat: at last!
2021-04-19 10:24:13 -04:00
Nick Mathewson
a271faca3a
rtcompat: mark some outputs as must-use.
2021-04-19 10:08:18 -04:00
Nick Mathewson
b8e1234a4c
Clarify what TlsConnector doesn't validate.
2021-04-19 08:24:22 -04:00
Nick Mathewson
50f5ad9850
Flatten async_std impl module slightly.
2021-04-19 08:20:20 -04:00
Nick Mathewson
e3c51519e8
Flatten tokio TcpProvider implementation a bit.
2021-04-19 08:15:12 -04:00
Nick Mathewson
065162aff2
Add a local_addr() function for TcpListener.
2021-04-18 18:02:30 -04:00
Nick Mathewson
975374beb5
Fix some broken rustdoc links.
2021-04-18 17:55:43 -04:00
Nick Mathewson
342a98dccd
tor_rtcompat: Documentation and cleanups
2021-04-17 17:09:20 -04:00
Nick Mathewson
a774cdde80
Remove the no-longer-needed "global runtime" code.
2021-04-17 17:09:20 -04:00