Skip to content

Commit

Permalink
Redact ##vso in CI (#6525)
Browse files Browse the repository at this point in the history
## Summary of changes

Redact `##vso` from being printed when we write test method arguments

## Reason for change

When printed to the console, this signifies a "command" which confuses
azdo:

```
##[warning]'11:09:46 [DBG] [xUnit.net 00:00:02.05] Datadog.Trace.Tools.Runner.IntegrationTests: STARTED: Datadog.Trace.Tools.Runner.IntegrationTests.ConfigureCiCommandTests.ConfigureCi(azp, ##vso\[task.setvariable variable=(?<name>[A-Z1-9_]+);\](?<value>.*), null)' contains logging command keyword '##vso', but it's not a legal command. Please see the list of accepted commands: https://go.microsoft.com/fwlink/?LinkId=817296
```

## Implementation details

Just replace `##vso` with `#####`

## Test coverage

Meh
  • Loading branch information
andrewlock authored Jan 10, 2025
1 parent c0b690a commit a0d1454
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tracer/test/Datadog.Trace.TestHelpers/CustomTestFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ protected override async Task<RunSummary> RunTestCaseAsync(IXunitTestCase testCa

if (testCase.TestMethodArguments != null)
{
parameters = string.Join(", ", testCase.TestMethodArguments.Select(a => a?.ToString() ?? "null"));
// We replace ##vso to avoid sending "commands" via the log output when we're testing CI Visibility stuff
// We should redact other CI's command prefixes as well in the future, but for now this is enough
parameters = string.Join(", ", testCase.TestMethodArguments.Select(a => a?.ToString()?.Replace("##vso", "#####") ?? "null"));
}

var test = $"{TestMethod.TestClass.Class.Name}.{TestMethod.Method.Name}({parameters})";
Expand Down

0 comments on commit a0d1454

Please sign in to comment.