[swift-corelibs-dev] URLSession test fest!

Peter Tomaselli vast.grapes at gmail.com
Fri Feb 3 13:11:56 CST 2017


Hi Pushkar, thanks so much for the information! That does help to clear
everything up.

I'm afraid I don't have a very specific solution to propose. Only that, at
a high level, I think both of these earlier versions will serve as good
inspiration for new tests. For example, there are some test cases in both
of these earlier versions that I would never have thought of myself.

While it's not exactly my area of expertise, the existing loopback server
is very interesting to me, so I hope to have some time soon to improve it a
bit, adding URLSession tests as I go.

Of course, it is slightly tricky when both the system-under-test and the
mechanism by which it is tested are under construction at the same time! :)

Cheers,

Peter

On Fri, Feb 3, 2017 at 1:44 AM, Pushkar N Kulkarni <pushkar.nk at in.ibm.com>
wrote:

> Hi Peter,
>
> I'll try to answer your questions to some extent!
>
>
> *I’m wondering if anyone has any info on what happened with the (rather
> more elaborate) “loopback” server and set of tests from @danieleggert’s PR
> #299:*
>
> *https://github.com/apple/swift-corelibs-foundation/pull/299*
> <https://github.com/apple/swift-corelibs-foundation/pull/299>
>
> *Is there some reason we ended up with a somewhat cut-down version of
> those (I understand that perhaps the URLSession implementation itself from
> this PR was not used, but perhaps we could pull some of the tests forward,
> or the more flexible loopback implementation) in master? Sorry if this is a
> silly question — I’m not very well-versed in the more low-level networking
> stuff involved here so there may be some obvious reason these are not
> suitable that I am missing.*
>
> >> Yes, PR 299 from Daniel Eggert had a much mature loopback server and a
> better test coverage. However, it used functionality from the internal
> classes in the NSURLSession package (HTTPBodySource and friends), for which
> we needed to used a @testable import
> <https://github.com/apple/swift-corelibs-foundation/pull/299/files#diff-aec4665d7562834babd21b66fa84ee45R20>in
> TestFoundation. If I remember our discussions right,  to support a
> `@testable import` you'd need to do build Foundation with the
> `-enable-testing` flag, which may not acceptable for Release builds. Of
> course, there was the possibility of rewriting this functionality (from the
> internal classes) all over again. But we decided to start with a simple
> loopback server and then build on it.
>
>
>
>
> *Mailing list user Mike Ferenduros also put together what to my eye are
> some pretty comprehensive tests that have not ever seemed to be PR’d or
> merged, described here:*
>
> *https://lists.swift.org/pipermail/swift-corelibs-dev/Week-of-Mon-20160912/000943.html*
> <https://lists.swift.org/pipermail/swift-corelibs-dev/Week-of-Mon-20160912/000943.html>
>
> *>> *Yes, I am aware of the extensive tests Mike Ferenduros has written.
> In my opinion, it will be great to have them contributed once we have a
> more mature loopback server infrastructure. Mike has also opened a dozen
> URLSession bugs!
>
>
>
> *Seems like there was some concern over the use of httpbin.org
> <http://httpbin.org>, but these could be perhaps pulled in and simply
> redirected to hit the loopback, as the rest seems pretty well thought-out.*
> >> The problem we have had with external URLs is the delays and
> intermittent failures which keep breaking the CI builds, causing much agony
> to many! Can you tell me more about this solution you propose?
>
>
>
> Thanks!
>
> Pushkar N Kulkarni,
> IBM Runtimes
>
> *Simplicity is prerequisite for reliability - Edsger W. Dijkstra*
>
>
>
> -----swift-corelibs-dev-bounces at swift.org wrote: -----
> To: swift-corelibs-dev <swift-corelibs-dev at swift.org>
> From: Peter Tomaselli via swift-corelibs-dev
> Sent by: swift-corelibs-dev-bounces at swift.org
> Date: 02/03/2017 08:11AM
> Subject: Re: [swift-corelibs-dev] URLSession test fest!
>
>
> Following up on this…
>
> I’m wondering if anyone has any info on what happened with the (rather
> more elaborate) “loopback” server and set of tests from @danieleggert’s PR
> #299:
>
> https://github.com/apple/swift-corelibs-foundation/pull/299
>
> Is there some reason we ended up with a somewhat cut-down version of those
> (I understand that perhaps the URLSession implementation itself from this
> PR was not used, but perhaps we could pull some of the tests forward, or
> the more flexible loopback implementation) in master? Sorry if this is a
> silly question — I’m not very well-versed in the more low-level networking
> stuff involved here so there may be some obvious reason these are not
> suitable that I am missing.
>
> Mailing list user Mike Ferenduros also put together what to my eye are
> some pretty comprehensive tests that have not ever seemed to be PR’d or
> merged, described here:
>
> https://lists.swift.org/pipermail/swift-corelibs-dev/
> Week-of-Mon-20160912/000943.html
>
> Seems like there was some concern over the use of httpbin.org, but these
> could be perhaps pulled in and simply redirected to hit the loopback, as
> the rest seems pretty well thought-out.
>
> Just wondering if anyone has any of the background information here. I
> started writing some tests and loopback enhancements of my own but these
> other two gentlemen are way ahead of me, so maybe we should grab what we
> can from them, if it is possible to do so! Happy to take a crack at that if
> it seems like a sane idea.
>
> Cheers,
>
> Peter
>
> On Jan 31, 2017, at 8:45 AM, Peter Tomaselli <vast.grapes at gmail.com>
> wrote:
>
> Rad, thanks Tony. I can run all the tests now. Hoping to have some time
> soon to dig in and see if I can make a contribution. Love that this thing
> is spinning up its own HTTP server for this — seems real fun.
>
> Cheers,
>
> Peter
>
> On Jan 30, 2017, at 5:46 PM, Tony Parker <anthony.parker at apple.com> wrote:
>
> I see what this problem is. I’ll have a PR up shortly to fix it.
>
> - Tony
>
>
>
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20170203/06b06b7e/attachment.html>


More information about the swift-corelibs-dev mailing list