[LRUG] Making Rails time out

Mr Jaba the.jaba at gmail.com
Fri Apr 19 07:34:59 PDT 2013


This looks like a potential solution:

http://stackoverflow.com/questions/2570489/is-there-anyway-to-make-a-rails-rack-application-tell-the-web-server-to-drop-t

Return a special status code to Nginx which will then silently drop the
connection. I think with Rails it will always want to return some kind of
response unless you do the sleep, so you might have to do this at the web
server level.




On 19 April 2013 15:31, Rob Anderson <
rob.anderson at paymentcardsolutions.co.uk> wrote:

> Yes, this would be a good way of implementing the test if I were writing
> the client. But I'm actually providing the service.
>
> This probably falls into the class of tests which it is the client's
> responsibility to implement / simulate.  But in our particular case it
> would be handy to have the server be able to do this.
>
>
> On 19 Apr 2013, at 15:22, George Drummond <drummond at rentify.com> wrote:
>
> If you are testing this in your test suite then use WebMock to mock a
> timeout
>
> https://github.com/bblimke/webmock/issues/16
>
>
> On 19 Apr 2013, at 15:07, Rob Anderson <
> rob.anderson at paymentcardsolutions.co.uk> wrote:
>
> Hello LRUG
>
> I have a weird requirement and I can't seem to figure out how to fulfill
> it using Rails.
>
> We provide a number of web services to third parties.  As part of their
> testing and accreditation with us they need to execute a variety of test
> cases.
>
> Some of the key test conditions involve making sure that exceptions are
> correctly handled.  So if for example they call one of our services and we
> return a 500 system exception, they handle this gracefully.
>
> One of the test cases we have come up with is what happens if our service
> just fails to respond at all - eg we accept the connection and then leave
> them hanging waiting for a response.  This should raise a client timeout
> and they should handle it appropriately.
>
> But it s not at all clear how to achieve this in our test system.  I could
> put in some monster sleep command, but I don't really want to block the
> process - ideally I just want to tell ActionController: forget it, your
> work is done.
>
> I suspect maybe this is very difficult / impossible because Apache /
> Passenger would also need to be told to stand down, but I don't know.
>  Can't find anything on Google either.
>
> Perhaps this is just an insane test case - but I know I have seen plenty
> of instances of this happening in the real world when we call other
> people's web services, so it would be good to be able to simulate it.
>
> Any thoughts gratefully received
>
> Rob
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130419/e7e998dd/attachment.html>


More information about the Chat mailing list