Skip to content

Pass process environment variables to the integration tests #5430

Open
@arturaz

Description

@arturaz

Currently mill's integration tests do not get all of the environment variables from the parent process.

This leads to MY_ENV_VAR=foo ./mill integration.feature[foo].local.nodaemon.testForked to not have access to MY_ENV_VAR, unless explicitly exposed via forkEnv .

def forkEnv = Task {
super.forkEnv() ++
IntegrationTestModule.this.forkEnv() ++
Map(
"MILL_INTEGRATION_DAEMON_MODE" -> (mode == "daemon").toString,
"MILL_INTEGRATION_IS_PACKAGED_LAUNCHER" -> millIntegrationIsPackagedLauncher().toString,
"MILL_LAUNCHER" -> build.dist.bootstrapLauncher().path.toString,
"MILL_LAUNCHER_BAT" -> build.dist.bootstrapLauncherBat().path.toString,
"MILL_INTEGRATION_LAUNCHER" -> millIntegrationLauncher().path.toString
) ++
envUpdateSnapshots() ++
(if (millIntegrationIsPackagedLauncher()) Map() else build.dist.localTestOverridesEnv())
}

This first reared it's head in #5292 and now again in #5425.

This can lead to subtle bugs. For example, I'm not sure the CI flag is ever actually passed to the test here:

val maxDurationMillis: Int = if (sys.env.contains("CI")) 120000 else 15000

I suggest forwarding all env variables, as we currently do with MILL_TESTS_BSP_UPDATE_SNAPSHOTS. Is there any downside to that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions