hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Clean up Client and Server integration tests

Open seanmonstar opened this issue 7 years ago • 9 comments

Both the client and server tests (tests/client.rs and tests/server.rs) started with small abstractions, but they weren't flexible enough, and so as more complicated cases were needed, the tests just got more and more complicated, with a lot of repetition. It'd be huge to find a way to refactor them.

seanmonstar avatar Oct 18 '18 19:10 seanmonstar

I will take this issue and work on it!

JeffLabonte avatar Nov 24 '18 17:11 JeffLabonte

Would you have something in mind as well? @seanmonstar

JeffLabonte avatar Nov 28 '18 04:11 JeffLabonte

@seanmonstar is it still open? :)

tiendq avatar Jun 24 '19 16:06 tiendq

Yes, this is still open because the integration tests feel very messy, and there's a lot of repeated code. I'm sorry I haven't been able to provide much guidance on how to improve them, if I thought about it a lot, I'd probably fix them myself :)

seanmonstar avatar Jun 24 '19 18:06 seanmonstar

Well, if it's very messy so we could improve it a little each PR, for example let's remove (as many as possible) repeated code first. If you feel ok with this approach I could try it :) (hopefully it's easy as labelled :D).

tiendq avatar Jun 25 '19 14:06 tiendq

I'd like to try and tackle this one if it hasn't been done yet! The tests seem quite long though...

ryanyz10 avatar Oct 10 '21 07:10 ryanyz10

Yea, it's not done yet. Admittedly, this is between an easy and medium task. For example, in tests/client.rs there is a few submodules testing different implementations or parts of the client API, and most are using a lot of the same code copied and pasted but then ever slightly modified. So it makes the files long, and more tedious to adjust. It'd be best if we could break it up into multiple tests/client_blah.rs files, separated by main "concerns", and with the various duplicate code cleaned up into smaller helpers.

seanmonstar avatar Oct 11 '21 23:10 seanmonstar

Ok great, I'll slowly work on this then.

ryanyz10 avatar Oct 19 '21 19:10 ryanyz10

Hi @seanmonstar Could you please take a look at https://github.com/hyperium/hyper/pull/3072

This PR doesn't provide any significant changes but allows to make one step in decreasing code duplication. If it's the wrong way, please, just reject the PR. If it brings something useful, then I can continue with it.

Thanks

alexs-sh avatar Dec 04 '22 13:12 alexs-sh