Skip to content
This repository was archived by the owner on Feb 22, 2025. It is now read-only.

Commit 80e48ed

Browse files
committed
Fix classic client environment in tests (#330)
Forbid telemetry, forbid keychain access.
1 parent cebf490 commit 80e48ed

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

client/backend/src/test/kotlin/com/microsoft/tfs/tests/ClassicClientUtils.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ private fun executeClient(directory: Path, vararg arguments: String) {
1717
val loginArgument = "-login:${IntegrationTestUtils.user},${IntegrationTestUtils.pass}"
1818
val process = ProcessBuilder(IntegrationTestUtils.tfExe, loginArgument, *arguments)
1919
.directory(directory.toFile())
20-
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
21-
.redirectError(ProcessBuilder.Redirect.INHERIT)
20+
.apply {
21+
environment().also {
22+
it["TF_NOTELEMETRY"] = "TRUE"
23+
it["TF_ADDITIONAL_JAVA_ARGS"] = "-Duser.country=US -Duser.language=en"
24+
it["TF_USE_KEYCHAIN"] = "FALSE" // will be stuck on com.microsoft.tfs.jni.internal.keychain.NativeKeychain.nativeFindInternetPassword on macOS otherwise
25+
}
26+
}
27+
.inheritIO()
2228
.start()
2329
val exitCode = process.waitFor()
2430
Assert.assertEquals(0, exitCode)
@@ -54,4 +60,4 @@ fun cloneTestRepository(): Path {
5460
fun deleteWorkspace(path: Path) {
5561
val workspaceName = "${path.fileName}.${IntegrationTestUtils.workspaceNameSuffix}"
5662
tfDeleteWorkspace(path, workspaceName)
57-
}
63+
}

0 commit comments

Comments
 (0)