Skip to content

Provide a MILL_TEST_FREE_PORT environment variable for tests to use (500USD Bounty) #3802

Description

@lihaoyi

From the maintainer Li Haoyi: I'm putting a 500USD bounty on this issue, payable by bank transfer on a merged PR implementing this.


Currently Mill's parallelism causes problems for test suites which need to spin up servers on localhost ports. Because different test suites may run in different tasks and subprocesses, coordinating across them to find free ports is annoying.

The Mill example test suite and the Cask example test suite just manually assigns the different web-server-related tests unique ports, but it is error-prone and should be automated

We may need to support a configurable number of unique ports (comma separated?) for test suites that need to spawn multiple services. Maybe we can annotate tasks with Task(freePorts = n) to mark them as needing free ports, like how we do persistent = true, and then Mill can assign those tasks ports starting from some base number (e.g. 9000) via the environment variable

The end result is that Mill's own example suite can remove all hardcoded ports and replace them with usages of the MILL_TEST_FREE_PORT environment variable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bountyThe fix/close of this issue is rewarded with a bounty

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions