You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Steve Loughran <st...@hortonworks.com> on 2015/04/08 12:16:25 UTC
finding free ports for tests
I'm writing some functional tests for the SPARK-1537 JIRA, Yarn timeline service integration, for which I need to allocate some free ports.
I don't want to hard code them in as that can lead to unreliable tests, especially on Jenkins.
Before I implement the logic myself -Is there a utility class/trait for finding ports for tests?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org
Re: finding free ports for tests
Posted by Steve Loughran <st...@hortonworks.com>.
On 8 Apr 2015, at 20:19, Hari Shreedharan <hs...@cloudera.com>> wrote:
One good way to guarantee your tests will work is to have your server bind to an ephemeral port and then query it to find the port it is running on. This ensures that race conditions don’t cause test failures.
yes, that's what I'm doing; the classic tactic. Find the tests fail if the laptop doesn't know its own name, but so do others
Thanks,
Hari
On Wed, Apr 8, 2015 at 3:24 AM, Sean Owen <so...@cloudera.com>> wrote:
Utils.startServiceOnPort?
On Wed, Apr 8, 2015 at 6:16 AM, Steve Loughran <st...@hortonworks.com>> wrote:
>
> I'm writing some functional tests for the SPARK-1537 JIRA, Yarn timeline service integration, for which I need to allocate some free ports.
>
> I don't want to hard code them in as that can lead to unreliable tests, especially on Jenkins.
>
> Before I implement the logic myself -Is there a utility class/trait for finding ports for tests?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org<ma...@spark.apache.org>
> For additional commands, e-mail: dev-help@spark.apache.org<ma...@spark.apache.org>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org<ma...@spark.apache.org>
For additional commands, e-mail: dev-help@spark.apache.org<ma...@spark.apache.org>
Re: finding free ports for tests
Posted by Hari Shreedharan <hs...@cloudera.com>.
One good way to guarantee your tests will work is to have your server bind to an ephemeral port and then query it to find the port it is running on. This ensures that race conditions don’t cause test failures.
Thanks, Hari
On Wed, Apr 8, 2015 at 3:24 AM, Sean Owen <so...@cloudera.com> wrote:
> Utils.startServiceOnPort?
> On Wed, Apr 8, 2015 at 6:16 AM, Steve Loughran <st...@hortonworks.com> wrote:
>>
>> I'm writing some functional tests for the SPARK-1537 JIRA, Yarn timeline service integration, for which I need to allocate some free ports.
>>
>> I don't want to hard code them in as that can lead to unreliable tests, especially on Jenkins.
>>
>> Before I implement the logic myself -Is there a utility class/trait for finding ports for tests?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
>> For additional commands, e-mail: dev-help@spark.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
> For additional commands, e-mail: dev-help@spark.apache.org
Re: finding free ports for tests
Posted by Sean Owen <so...@cloudera.com>.
Utils.startServiceOnPort?
On Wed, Apr 8, 2015 at 6:16 AM, Steve Loughran <st...@hortonworks.com> wrote:
>
> I'm writing some functional tests for the SPARK-1537 JIRA, Yarn timeline service integration, for which I need to allocate some free ports.
>
> I don't want to hard code them in as that can lead to unreliable tests, especially on Jenkins.
>
> Before I implement the logic myself -Is there a utility class/trait for finding ports for tests?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
> For additional commands, e-mail: dev-help@spark.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org