Commit Graph

47 Commits

Author SHA1 Message Date
Matt Joiner 3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Matt Joiner 5501f994ca
Move a bunch of stuff into subpackages
The core package is very large now, and often only parts of it are needed.
2022-11-15 23:31:26 +11:00
Matt Joiner aa4a831c78
Rearrange transfer tests so build directives are applied by the right packages 2022-03-17 16:08:00 +11:00
Eng Zer Jun 841a702e34
test: use `T.TempDir` to create temporary test directory (#718)
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-02 18:26:46 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner 3d49a29288 Support minimum peer extensions 2021-10-25 20:52:44 +11:00
Matt Joiner 62c83a5b9c Add to tests for Torrent.Complete 2021-10-07 13:38:29 +11:00
Matt Joiner da1221dd50 Change Peer._peerPieces to use raw roaring Bitmap type
The wrapper type was from when roaring didn't support zero-alloc initialization.
2021-10-05 17:48:34 +11:00
Matt Joiner a3c2d76b4a Limit keep alives for rate limited download test 2021-08-19 13:37:00 +10:00
Matt Joiner b9c7d6266b Tidy up the Dialer interface 2021-06-21 13:29:26 +10:00
Matt Joiner 9f5ce7e90e Mark client transfer test as parallel 2021-06-21 12:30:05 +10:00
Matt Joiner 5fc42e8105 Remove sqlite piece-resource storage 2021-06-21 12:29:37 +10:00
Matt Joiner 95d808d3c5 Use rejiggered missinggo bitmap 2021-06-07 13:01:39 +10:00
Matt Joiner 5f8471e21b Rework storage.TorrentImpl to support shared capacity key 2021-06-07 13:01:39 +10:00
Matt Joiner 20c00dedc0 Rework lots of option handling 2021-05-05 21:36:36 +10:00
Matt Joiner afea28091f Implement sqlite directly without using piece resources 2021-05-04 19:51:42 +10:00
Matt Joiner 7f7c59d52e Replace internal/tmproot with Testing.TB.TempDir 2021-02-22 14:30:09 +11:00
Matt Joiner c714cb6992 Fix some go vet warnings 2021-02-03 19:42:46 +11:00
Matt Joiner 15ccbc95c6 Fix sqlite storage for numconns 1 2021-02-02 10:41:39 +11:00
Matt Joiner 4ae8a1bc52 Add tests for numconns 2 2021-02-02 10:41:38 +11:00
Matt Joiner f5915ad12c Use iotest.TestReader 2021-01-29 23:32:01 +11:00
Matt Joiner beb9ec8ffe Fix transfer tests involving sqlite memory storage 2021-01-25 15:54:37 +11:00
Matt Joiner 2ddd3169ef Move storage piece benchmarks to storage/test and add a lot more dials 2021-01-25 15:54:37 +11:00
Matt Joiner ded6c19edb Add the DropMutuallyCompletePeers ClientConfig field 2021-01-05 16:58:45 +11:00
Matt Joiner b75ebbf9e7 sqlite storage: Provide helpers and reasonable defaults 2020-10-30 12:20:54 +11:00
Matt Joiner 8e1a8440bf Performance fiddling on sqlite storage 2020-10-27 17:07:49 +11:00
Matt Joiner 43891309ad Return errors from Reader if data downloading won't occur
Chunk write errors to storage can disable data download. Previously Readers would wait indefinitely for the data to become available. This change returns an error instead of stalling.
2020-10-27 14:10:17 +11:00
Matt Joiner 07bc79dbdc Test both sqlite file and in-memory leecher storages 2020-10-13 13:34:05 +11:00
Matt Joiner d820f7861c Add a sqlite data storage implementation 2020-10-11 12:58:27 +11:00
Matt Joiner 417d7d1d48 Tweaks to storage error and completion handling 2020-10-11 12:54:03 +11:00
Matt Joiner 898260c177 Tidy up some storage close handling 2020-10-11 12:40:43 +11:00
Matt Joiner 3d7a95a65d Use testing.T.Name instead of missinggo.GetTestName
This handles subtests correctly, and removes the need to specify when to export due to collisions with the old function.
2020-10-10 10:59:17 +11:00
Matt Joiner f6c757ca65 Add tests for https://github.com/anacrolix/torrent/issues/388 2020-05-19 14:59:45 +10:00
Matt Joiner 3e9a5a4aec Expose ClientConfig.Extensions
Also run the storage failure test with fast disabled for the seeder. This probably would have tickled some issues in the past, so it seems like a good place to try it out.
2020-04-23 13:03:40 +10:00
Matt Joiner 03887dbc80 Close leaked Clients in test 2020-04-23 12:28:48 +10:00
Matt Joiner f432430256 Use anacrolix/log in test 2020-04-23 11:30:19 +10:00
Matt Joiner 013fa1df5a Fix transfer test check for seeder piece counts
I suspect that there's a race where a connection is established to the seeder, but we haven't received it's completed piece information yet, and we already finished reading all the data we need from another connection. Probably comes up now because pending peers with the same address aren't clobbering each other since that was fixed.
2020-04-17 11:40:25 +10:00
Matt Joiner e5f7765dfa Fix small cache transfer tests
Since hashing Peer Addrs in the Torrent pending peers, clients are getting more than one connection to the seeder in the tests and failing.
2020-04-16 14:12:17 +10:00
Matt Joiner c2210c058c Fix pending peer counts in transfer tests
Also expose number of peers successfully added in some method returns.
2020-04-16 14:09:45 +10:00
Matt Joiner 19ce53e69f Make io.EOF an expected error from storage.Piece.ReadAt
Fixes #381.
2020-02-27 16:45:57 +11:00
Matt Joiner bae791a5a2 Disable data downloading on storage write errors
Also add a hook and Torrent methods to modify this.
2020-02-22 19:40:50 +11:00
Matt Joiner ddc61845ac Misc cleanup 2020-02-22 19:38:56 +11:00
Matt Joiner b16118ee18 Add a test for storage write errors
Addresses #377
2020-02-21 14:56:21 +11:00
Matt Joiner c855c7a366 Differentiate between storage.ClientImpl{,Closer} 2020-02-21 14:12:44 +11:00
Matt Joiner ddddc63924 Expose PeerConn.PeerPieces
Fixes #375.
2020-02-21 11:51:24 +11:00
Matt Joiner d24922dc09 Add support for non-IP-based networks
Includes a test with unix sockets. Exposes AddDialer, AddListener, and reworks Peer.
2020-02-20 16:47:37 +11:00
Matt Joiner 0d4858ba29 Extract the transfer tests
We need them external the torrent package so we can test the API for adding dialers and listeners.
2020-02-20 13:57:24 +11:00