You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-dev@hadoop.apache.org by bhallamudi kamesh <bh...@huawei.com> on 2011/01/17 15:04:18 UTC

How to write test cases for ensuing stream's/socket's closure either in catch block or finally block

Hi All,
  How to write test cases for the scenarios such as throwing an IOException from the try block and ensuing that corresponding stream's/socket's closure either in catch block or in finally block.
  Do we need to write test cases for these scenarios in order to submit patches?

  Thanks in advance

With Regards,
Bh.V.S.Kamesh.




Re: How to write test cases for ensuing stream's/socket's closure either in catch block or finally block

Posted by Konstantin Boudnik <co...@apache.org>.
Moving hdfs-dev@ and mapreduce-dev@ to Bcc: to avoid cross-postings.

>From what I understand you want to have a test case which demonstrates
that whatever socket/stream connections were opened are properly
closed in case of IOException? I guess one of many possibilities would
be to check if a connection is still open after IOException were
thrown.

For the second part of your (quite open-ended) question: if you make a
modification that might potentially leave unclaimed resources such as
socket connection in case of abnormal control flow then yes - you'd
better have a test case to cover that error recovery is done properly.

--
  Take care,
Konstantin (Cos) Boudnik



On Mon, Jan 17, 2011 at 06:04, bhallamudi kamesh
<bh...@huawei.com> wrote:
> Hi All,
>  How to write test cases for the scenarios such as throwing an IOException from the try block and ensuing that corresponding stream's/socket's closure either in catch block or in finally block.
>  Do we need to write test cases for these scenarios in order to submit patches?
>
>  Thanks in advance
>
> With Regards,
> Bh.V.S.Kamesh.
>
>
>
>

Re: How to write test cases for ensuing stream's/socket's closure either in catch block or finally block

Posted by Konstantin Boudnik <co...@apache.org>.
Moving hdfs-dev@ and mapreduce-dev@ to Bcc: to avoid cross-postings.

>From what I understand you want to have a test case which demonstrates
that whatever socket/stream connections were opened are properly
closed in case of IOException? I guess one of many possibilities would
be to check if a connection is still open after IOException were
thrown.

For the second part of your (quite open-ended) question: if you make a
modification that might potentially leave unclaimed resources such as
socket connection in case of abnormal control flow then yes - you'd
better have a test case to cover that error recovery is done properly.

--
  Take care,
Konstantin (Cos) Boudnik



On Mon, Jan 17, 2011 at 06:04, bhallamudi kamesh
<bh...@huawei.com> wrote:
> Hi All,
>  How to write test cases for the scenarios such as throwing an IOException from the try block and ensuing that corresponding stream's/socket's closure either in catch block or in finally block.
>  Do we need to write test cases for these scenarios in order to submit patches?
>
>  Thanks in advance
>
> With Regards,
> Bh.V.S.Kamesh.
>
>
>
>

Re: How to write test cases for ensuing stream's/socket's closure either in catch block or finally block

Posted by Konstantin Boudnik <co...@apache.org>.
Moving hdfs-dev@ and mapreduce-dev@ to Bcc: to avoid cross-postings.

>From what I understand you want to have a test case which demonstrates
that whatever socket/stream connections were opened are properly
closed in case of IOException? I guess one of many possibilities would
be to check if a connection is still open after IOException were
thrown.

For the second part of your (quite open-ended) question: if you make a
modification that might potentially leave unclaimed resources such as
socket connection in case of abnormal control flow then yes - you'd
better have a test case to cover that error recovery is done properly.

--
  Take care,
Konstantin (Cos) Boudnik



On Mon, Jan 17, 2011 at 06:04, bhallamudi kamesh
<bh...@huawei.com> wrote:
> Hi All,
>  How to write test cases for the scenarios such as throwing an IOException from the try block and ensuing that corresponding stream's/socket's closure either in catch block or in finally block.
>  Do we need to write test cases for these scenarios in order to submit patches?
>
>  Thanks in advance
>
> With Regards,
> Bh.V.S.Kamesh.
>
>
>
>