redismodule-rs icon indicating copy to clipboard operation
redismodule-rs copied to clipboard

Simplify the integration test code

Open iddm opened this issue 1 year ago • 5 comments

iddm avatar Nov 24 '23 10:11 iddm

@MeirShpilraien, would you please review once again?

iddm avatar Apr 29 '24 15:04 iddm

@iddm @MeirShpilraien Why not move the change into utils.rs and expose it as part of the crate? It would allow users to use the code to test their modules.

ashtul avatar May 26 '24 18:05 ashtul

@iddm @MeirShpilraien Why not move the change into utils.rs and expose it as part of the crate? It would allow users to use the code to test their modules.

We need it just in one single file, there is no need to create a file of 20 lines of code to just fully import it later from within another file. Doesn't really contribute to the cleanliness of the code here. If at least we had two files for that, - sure.

iddm avatar May 27 '24 07:05 iddm

We need it just in one single file, there is no need to create a file of 20 lines of code to just fully import it later from within another file. Doesn't really contribute to the cleanliness of the code here. If at least we had two files for that, - sure.

I agree but also I think that its a nice idea that users will be able to test their module with rust and run it with cargo test. I believe that if we want to do it, we should make a crate that will expose all the needed functionality (setting up Redis server with the module and with/without replication or on cluster mode, aof enabled/disabled, and probably there are much more things that we want to do). That said, all this functionalities are already exists on RLTest so maybe its not worth it?

MeirShpilraien avatar May 27 '24 08:05 MeirShpilraien

We need it just in one single file, there is no need to create a file of 20 lines of code to just fully import it later from within another file. Doesn't really contribute to the cleanliness of the code here. If at least we had two files for that, - sure.

I agree but also I think that its a nice idea that users will be able to test their module with rust and run it with cargo test. I believe that if we want to do it, we should make a crate that will expose all the needed functionality (setting up Redis server with the module and with/without replication or on cluster mode, aof enabled/disabled, and probably there are much more things that we want to do). That said, all this functionalities are already exists on RLTest so maybe its not worth it?

This isn't something specific to Redis, redismodule (this crate) or redis modules, or Rust in general. Anyone can write their own tests. But, I had already forgotten we had the utils.rs file there. Now that I know it is there, it makes sense to move it there. Perhaps, I had already done it this way a long time ago before even this PR, but we closed it for another reason, cuz now I remember moving the things into it. So, yes, I'll move it to the utils.rs.

iddm avatar May 27 '24 08:05 iddm