<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Thanks Tom - that would indeed be the perfect solution, but we're deployed on Apache sadly.</div><div><br></div><div>But I think you're right that this is a web server thing rather than a Rails thing.  A long sleep is probably the answer.  As it often is on a Friday afternoon.</div><div><br></div><div><br><div><div><div>On 19 Apr 2013, at 15:34, Mr Jaba <<a href="mailto:the.jaba@gmail.com">the.jaba@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>This looks like a potential solution:<br><br><a href="http://stackoverflow.com/questions/2570489/is-there-anyway-to-make-a-rails-rack-application-tell-the-web-server-to-drop-t">http://stackoverflow.com/questions/2570489/is-there-anyway-to-make-a-rails-rack-application-tell-the-web-server-to-drop-t</a><br>
<br></div>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. <br>
<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 19 April 2013 15:31, Rob Anderson <span dir="ltr"><<a href="mailto:rob.anderson@paymentcardsolutions.co.uk" target="_blank">rob.anderson@paymentcardsolutions.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Yes, this would be a good way of implementing the test if I were writing the client. But I'm actually providing the service.</div>
<div><br></div><div>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.</div>
<div><br></div><br><div><div>On 19 Apr 2013, at 15:22, George Drummond <<a href="mailto:drummond@rentify.com" target="_blank">drummond@rentify.com</a>> wrote:</div><br><blockquote type="cite"><div style="word-wrap:break-word">
If you are testing this in your test suite then use WebMock to mock a timeout<div><br></div><div><a href="https://github.com/bblimke/webmock/issues/16" target="_blank">https://github.com/bblimke/webmock/issues/16</a></div>
<div><div class="h5"><div><br></div><div><br><div><div>On 19 Apr 2013, at 15:07, Rob Anderson <<a href="mailto:rob.anderson@paymentcardsolutions.co.uk" target="_blank">rob.anderson@paymentcardsolutions.co.uk</a>> wrote:</div>
<br><blockquote type="cite">Hello LRUG<br><br>I have a weird requirement and I can't seem to figure out how to fulfill it using Rails.<br><br>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.<br>
<br>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. <br><br>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.<br>
<br>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.<br>
<br>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.<br><br>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.<br>
<br>Any thoughts gratefully received<br><br>Rob<br><br><br><br>_______________________________________________<br>Chat mailing list<br><a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div><br></div></div></div></div></blockquote></div><br></div><br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></body></html>