refactor: move shared test functionality to a dev-dependency#193
refactor: move shared test functionality to a dev-dependency#193da2ce7 wants to merge 1 commit intotorrust:developfrom
Conversation
|
HI @WarmBeer, I'm reviewing this PR, but my first impressions are:
I suppose you want to add more stuff in the "test-helpers" package in the future, but we should carefully think about the structure we want in the future, otherwise, It could a pain to reorganize the packages. I think in the future, I could end up having at least 4 main components:
If we end up having those packages (independently released), we would need to extract things from "primitives" and "test-helpers" packages. And that could be a big effort if those packages become too big. |
josecelano
left a comment
There was a problem hiding this comment.
Hey @WarmBeer, the HTTP tracker is not using the new state machine in production:
- https://github.com/da2ce7/torrust-tracker/blob/156-warm_beer/src/http/axum_implementation/server.rs
- https://github.com/da2ce7/torrust-tracker/blob/156-warm_beer/src/http/warp_implementation/server.rs
Did you forget it? Or do you want to keep out of this PR for some reason?
| } | ||
| } | ||
|
|
||
| pub mod signals { |
There was a problem hiding this comment.
Hi @WarmBeer, why don't you add a new signals mod.rs file? I think lib mod tends to be a place to put things that you do not have a name for yet :-), but it this case you have the name.
|
|
||
| pub fn tracker_configuration() -> Arc<Configuration> { | ||
| Arc::new(ephemeral_configuration()) | ||
| Arc::new(ephemeral()) |
There was a problem hiding this comment.
Hi @WarmBeer, In this cases, I like to use the super mod like this:
Arc::new(configuration::ephemeral())Otherwise, it forces you to go up to read the "use" lines to know what ephemeral is? or to read what the function returns.
Hey @josecelano , Thank you for reviewing!
The "primitives" crate is supposed to be the crate that holds all the common types and functions that don't fit anywhere else. Like https://github.com/paritytech/polkadot/blob/master/core-primitives/src/lib.rs . In this PR, I have only moved the If we isolate the database logic and tracker logic into their own crates, we could move these enums to those and might not even need a primitives crate. Although it might not be a bad idea to have a light primitives crate that we can import into our other crates. Having to depend on a big database crate when you only need one type is not very efficient.
Moving
The idea is that all our packages could be independently released as-is. I think that we should focus on crate isolation rather sooner than later. I had to deal with a lot of merge conflicts for this PR. Isolating crates will also speed up the dreadful compilation time: https://endler.dev/2020/rust-compile-times/#use-cargo-workspaces |
hi, @WarmBeer have you considered having multiple primitive packages? I'm afraid of having all packaged coupled to that one. But I like the idea of extracting only things when we needed. Maybe we can continue with this approach but try to keep a well-defined structure for the primitives. For example, we could add a "http_tracker" mod from primitives that are only used in the context of HTTP trackers.
Could we use cargo "features" to import only the primitives and keep them in their original package?
I have not realized we could independently release those packages even if they are inside the same repo. I think we can merge the PR, it's a very good improvement, but I would:
|
|
Moved back to #170 |
Squashed Version of #170