mirror of
https://github.com/actions/runner.git
synced 2025-12-14 13:43:33 +00:00
Add Proxy Support for self-hosted runner. (#206)
This commit is contained in:
@@ -107,6 +107,35 @@ namespace GitHub.Runner.Common.Tests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Common")]
|
||||
public void SecretMaskerForProxy()
|
||||
{
|
||||
try
|
||||
{
|
||||
Environment.SetEnvironmentVariable("http_proxy", "http://user:password123@127.0.0.1:8888");
|
||||
|
||||
// Arrange.
|
||||
Setup();
|
||||
|
||||
// Assert.
|
||||
var logFile = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"trace_{nameof(HostContextL0)}_{nameof(SecretMaskerForProxy)}.log");
|
||||
var tempFile = Path.GetTempFileName();
|
||||
File.Delete(tempFile);
|
||||
File.Copy(logFile, tempFile);
|
||||
var content = File.ReadAllText(tempFile);
|
||||
Assert.DoesNotContain("password123", content);
|
||||
Assert.Contains("http://user:***@127.0.0.1:8888", content);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.SetEnvironmentVariable("http_proxy", null);
|
||||
// Cleanup.
|
||||
Teardown();
|
||||
}
|
||||
}
|
||||
|
||||
private void Setup([CallerMemberName] string testName = "")
|
||||
{
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
|
||||
Reference in New Issue
Block a user