mirror of
https://github.com/actions/runner.git
synced 2026-01-02 07:59:00 +08:00
Fix IDE0090 (#2211)
This commit is contained in:
@@ -18,7 +18,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
string message;
|
||||
ActionCommand test;
|
||||
ActionCommand verify;
|
||||
HashSet<string> commands = new HashSet<string>() { "do-something" };
|
||||
HashSet<string> commands = new() { "do-something" };
|
||||
//##[do-something k1=v1;]msg
|
||||
message = "##[do-something k1=v1;]msg";
|
||||
test = new ActionCommand("do-something")
|
||||
@@ -99,7 +99,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
string message;
|
||||
ActionCommand test;
|
||||
ActionCommand verify;
|
||||
HashSet<string> commands = new HashSet<string>() { "do-something" };
|
||||
HashSet<string> commands = new() { "do-something" };
|
||||
//::do-something k1=v1;]msg
|
||||
message = "::do-something k1=v1,::msg";
|
||||
test = new ActionCommand("do-something")
|
||||
|
||||
@@ -228,8 +228,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
{
|
||||
// Set up a few things
|
||||
// 1. Job request message (with ACTIONS_STEP_DEBUG = true)
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
|
||||
@@ -1028,7 +1028,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
//Arrange
|
||||
Setup();
|
||||
|
||||
Pipelines.ActionStep instance = new Pipelines.ActionStep()
|
||||
Pipelines.ActionStep instance = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Reference = new Pipelines.ContainerRegistryReference()
|
||||
@@ -1065,7 +1065,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
//Arrange
|
||||
Setup();
|
||||
|
||||
Pipelines.ActionStep instance = new Pipelines.ActionStep()
|
||||
Pipelines.ActionStep instance = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Reference = new Pipelines.ScriptReference()
|
||||
@@ -1137,7 +1137,7 @@ runs:
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1236,7 +1236,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1328,7 +1328,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1397,7 +1397,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1479,7 +1479,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1555,7 +1555,7 @@ runs:
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1653,7 +1653,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1745,7 +1745,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1814,7 +1814,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1893,7 +1893,7 @@ runs:
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
@@ -1983,7 +1983,7 @@ runs:
|
||||
Assert.Equal(directory, definition.Directory);
|
||||
Assert.NotNull(definition.Data);
|
||||
Assert.NotNull(definition.Data.Inputs); // inputs
|
||||
Dictionary<string, string> inputDefaults = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, string> inputDefaults = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var input in definition.Data.Inputs)
|
||||
{
|
||||
var name = input.Key.AssertString("key").Value;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
private IActionManifestManager _actionManifestManager;
|
||||
private Mock<IFileCommandManager> _fileCommandManager;
|
||||
|
||||
private DictionaryContextData _context = new DictionaryContextData();
|
||||
private DictionaryContextData _context = new();
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
@@ -60,7 +60,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
_actionRunner.Action = action;
|
||||
|
||||
Dictionary<string, string> finialInputs = new Dictionary<string, string>();
|
||||
Dictionary<string, string> finialInputs = new();
|
||||
_handlerFactory.Setup(x => x.Create(It.IsAny<IExecutionContext>(), It.IsAny<ActionStepDefinitionReference>(), It.IsAny<IStepHost>(), It.IsAny<ActionExecutionData>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Variables>(), It.IsAny<string>(), It.IsAny<List<JobExtensionRunner>>()))
|
||||
.Callback((IExecutionContext executionContext, Pipelines.ActionStepDefinitionReference actionReference, IStepHost stepHost, ActionExecutionData data, Dictionary<string, string> inputs, Dictionary<string, string> environment, Variables runtimeVariables, string taskDirectory, List<JobExtensionRunner> localActionContainerSetupSteps) =>
|
||||
{
|
||||
@@ -106,7 +106,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
_actionRunner.Action = action;
|
||||
|
||||
Dictionary<string, string> finialInputs = new Dictionary<string, string>();
|
||||
Dictionary<string, string> finialInputs = new();
|
||||
_handlerFactory.Setup(x => x.Create(It.IsAny<IExecutionContext>(), It.IsAny<ActionStepDefinitionReference>(), It.IsAny<IStepHost>(), It.IsAny<ActionExecutionData>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Variables>(), It.IsAny<string>(), It.IsAny<List<JobExtensionRunner>>()))
|
||||
.Callback((IExecutionContext executionContext, Pipelines.ActionStepDefinitionReference actionReference, IStepHost stepHost, ActionExecutionData data, Dictionary<string, string> inputs, Dictionary<string, string> environment, Variables runtimeVariables, string taskDirectory, List<JobExtensionRunner> localActionContainerSetupSteps) =>
|
||||
{
|
||||
@@ -307,7 +307,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
_actionRunner.Action = action;
|
||||
|
||||
Dictionary<string, string> finialInputs = new Dictionary<string, string>();
|
||||
Dictionary<string, string> finialInputs = new();
|
||||
_handlerFactory.Setup(x => x.Create(It.IsAny<IExecutionContext>(), It.IsAny<ActionStepDefinitionReference>(), It.IsAny<IStepHost>(), It.IsAny<ActionExecutionData>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Variables>(), It.IsAny<string>(), It.IsAny<List<JobExtensionRunner>>()))
|
||||
.Callback((IExecutionContext executionContext, Pipelines.ActionStepDefinitionReference actionReference, IStepHost stepHost, ActionExecutionData data, Dictionary<string, string> inputs, Dictionary<string, string> environment, Variables runtimeVariables, string taskDirectory, List<JobExtensionRunner> localActionContainerSetupSteps) =>
|
||||
{
|
||||
@@ -358,7 +358,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
_actionRunner.Action = action;
|
||||
|
||||
Dictionary<string, string> finialInputs = new Dictionary<string, string>();
|
||||
Dictionary<string, string> finialInputs = new();
|
||||
_handlerFactory.Setup(x => x.Create(It.IsAny<IExecutionContext>(), It.IsAny<ActionStepDefinitionReference>(), It.IsAny<IStepHost>(), It.IsAny<ActionExecutionData>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Variables>(), It.IsAny<string>(), It.IsAny<List<JobExtensionRunner>>()))
|
||||
.Callback((IExecutionContext executionContext, Pipelines.ActionStepDefinitionReference actionReference, IStepHost stepHost, ActionExecutionData data, Dictionary<string, string> inputs, Dictionary<string, string> environment, Variables runtimeVariables, string taskDirectory, List<JobExtensionRunner> localActionContainerSetupSteps) =>
|
||||
{
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
private ContainerOperationProvider containerOperationProvider;
|
||||
private Mock<IJobServerQueue> serverQueue;
|
||||
private Mock<IPagingLogger> pagingLogger;
|
||||
private List<string> healthyDockerStatus = new List<string> { "healthy" };
|
||||
private List<string> emptyDockerStatus = new List<string> { string.Empty };
|
||||
private List<string> unhealthyDockerStatus = new List<string> { "unhealthy" };
|
||||
private List<string> dockerLogs = new List<string> { "log1", "log2", "log3" };
|
||||
private List<string> healthyDockerStatus = new() { "healthy" };
|
||||
private List<string> emptyDockerStatus = new() { string.Empty };
|
||||
private List<string> unhealthyDockerStatus = new() { "unhealthy" };
|
||||
private List<string> dockerLogs = new() { "log1", "log2", "log3" };
|
||||
|
||||
List<ContainerInfo> containers = new List<ContainerInfo>();
|
||||
List<ContainerInfo> containers = new();
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
|
||||
@@ -189,8 +189,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
_issues = new List<Tuple<DTWebApi.Issue, string>>();
|
||||
|
||||
// Setup a job request
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "Summary Job";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -101,8 +101,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -157,8 +157,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -211,8 +211,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -260,8 +260,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -311,8 +311,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -409,8 +409,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -493,8 +493,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
{
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -548,8 +548,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -591,8 +591,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -655,8 +655,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
@@ -851,8 +851,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
{
|
||||
using (TestHostContext hc = CreateTestContext())
|
||||
{
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, jobName, jobName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
{
|
||||
variables["DistributedTask.ForceGithubJavascriptActionsToNode16"] = serverFeatureFlag;
|
||||
}
|
||||
Variables serverVariables = new Variables(hc, variables);
|
||||
Variables serverVariables = new(hc, variables);
|
||||
|
||||
// Workflow opt-out
|
||||
var workflowVariables = new Dictionary<string, string>();
|
||||
|
||||
@@ -67,10 +67,10 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
}
|
||||
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new Timeline(Guid.NewGuid());
|
||||
|
||||
List<Pipelines.ActionStep> steps = new List<Pipelines.ActionStep>()
|
||||
List<Pipelines.ActionStep> steps = new()
|
||||
{
|
||||
new Pipelines.ActionStep()
|
||||
{
|
||||
@@ -101,7 +101,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
Guid jobId = Guid.NewGuid();
|
||||
_message = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, "test", "test", null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), steps, null, null, null, null);
|
||||
GitHubContext github = new GitHubContext();
|
||||
GitHubContext github = new();
|
||||
github["repository"] = new Pipelines.ContextData.StringContextData("actions/runner");
|
||||
github["secret_source"] = new Pipelines.ContextData.StringContextData("Actions");
|
||||
_message.ContextData.Add("github", github);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
{
|
||||
private IExecutionContext _jobEc;
|
||||
private JobRunner _jobRunner;
|
||||
private List<IStep> _initResult = new List<IStep>();
|
||||
private List<IStep> _initResult = new();
|
||||
private Pipelines.AgentJobRequestMessage _message;
|
||||
private CancellationTokenSource _tokenSource;
|
||||
private Mock<IJobServer> _jobServer;
|
||||
@@ -55,7 +55,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
_jobRunner = new JobRunner();
|
||||
_jobRunner.Initialize(hc);
|
||||
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TaskOrchestrationPlanReference plan = new();
|
||||
TimelineReference timeline = new Timeline(Guid.NewGuid());
|
||||
Guid jobId = Guid.NewGuid();
|
||||
_message = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, testName, testName, null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), new List<Pipelines.ActionStep>(), null, null, null, null);
|
||||
|
||||
@@ -199,13 +199,13 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[CallerMemberName] string name = "")
|
||||
{
|
||||
// Setup the host context.
|
||||
TestHostContext hc = new TestHostContext(this, name);
|
||||
TestHostContext hc = new(this, name);
|
||||
|
||||
// Setup the execution context.
|
||||
_ec = new Mock<IExecutionContext>();
|
||||
_ec.Setup(x => x.Global).Returns(new GlobalContext());
|
||||
|
||||
GitHubContext githubContext = new GitHubContext();
|
||||
GitHubContext githubContext = new();
|
||||
_ec.Setup(x => x.GetGitHubContext("repository")).Returns("actions/runner");
|
||||
|
||||
// Store the expected tracking file path.
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
private TestHostContext CreateTestContext([CallerMemberName] String testName = "")
|
||||
{
|
||||
var hc = new TestHostContext(this, testName);
|
||||
Dictionary<string, VariableValue> variablesToCopy = new Dictionary<string, VariableValue>();
|
||||
Dictionary<string, VariableValue> variablesToCopy = new();
|
||||
_variables = new Variables(
|
||||
hostContext: hc,
|
||||
copy: variablesToCopy);
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
public TestHostContext Setup([CallerMemberName] string name = "")
|
||||
{
|
||||
// Setup the host context.
|
||||
TestHostContext hc = new TestHostContext(this, name);
|
||||
TestHostContext hc = new(this, name);
|
||||
|
||||
// Create a random work path.
|
||||
_workFolder = hc.GetDirectory(WellKnownDirectory.Work);
|
||||
|
||||
// Setup the execution context.
|
||||
_ec = new Mock<IExecutionContext>();
|
||||
GitHubContext githubContext = new GitHubContext();
|
||||
GitHubContext githubContext = new();
|
||||
_ec.Setup(x => x.GetGitHubContext("repository")).Returns("actions/runner");
|
||||
|
||||
// Setup the tracking manager.
|
||||
@@ -113,7 +113,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
using (TestHostContext hc = Setup())
|
||||
{
|
||||
// Arrange.
|
||||
TrackingConfig config = new TrackingConfig() { RepositoryName = "actions/runner" };
|
||||
TrackingConfig config = new() { RepositoryName = "actions/runner" };
|
||||
string trackingFile = Path.Combine(_workFolder, "trackingconfig.json");
|
||||
|
||||
// Act.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void Constructor_AppliesMaskHints()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var copy = new Dictionary<string, VariableValue>
|
||||
@@ -36,7 +36,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void Constructor_HandlesNullValue()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var copy = new Dictionary<string, VariableValue>
|
||||
@@ -59,7 +59,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void Constructor_SetsNullAsEmpty()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var copy = new Dictionary<string, VariableValue>
|
||||
@@ -80,7 +80,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void Constructor_SetsOrdinalIgnoreCaseComparer()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
CultureInfo currentCulture = CultureInfo.CurrentCulture;
|
||||
@@ -115,7 +115,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void Constructor_SkipVariableWithEmptyName()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var copy = new Dictionary<string, VariableValue>
|
||||
@@ -139,7 +139,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void Get_ReturnsNullIfNotFound()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var variables = new Variables(hc, new Dictionary<string, VariableValue>());
|
||||
@@ -157,7 +157,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void GetBoolean_DoesNotThrowWhenNull()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var variables = new Variables(hc, new Dictionary<string, VariableValue>());
|
||||
@@ -175,7 +175,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
[Trait("Category", "Worker")]
|
||||
public void GetEnum_DoesNotThrowWhenNull()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
var variables = new Variables(hc, new Dictionary<string, VariableValue>());
|
||||
|
||||
@@ -25,17 +25,17 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
private Pipelines.AgentJobRequestMessage CreateJobRequestMessage(string jobName)
|
||||
{
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference() { PlanId = Guid.NewGuid() };
|
||||
TaskOrchestrationPlanReference plan = new() { PlanId = Guid.NewGuid() };
|
||||
TimelineReference timeline = null;
|
||||
Dictionary<string, VariableValue> variables = new Dictionary<string, VariableValue>(StringComparer.OrdinalIgnoreCase);
|
||||
Dictionary<string, VariableValue> variables = new(StringComparer.OrdinalIgnoreCase);
|
||||
variables[Constants.Variables.System.Culture] = "en-US";
|
||||
Pipelines.JobResources resources = new Pipelines.JobResources();
|
||||
Pipelines.JobResources resources = new();
|
||||
var serviceEndpoint = new ServiceEndpoint();
|
||||
serviceEndpoint.Authorization = new EndpointAuthorization();
|
||||
serviceEndpoint.Authorization.Parameters.Add("nullValue", null);
|
||||
resources.Endpoints.Add(serviceEndpoint);
|
||||
|
||||
List<Pipelines.ActionStep> actions = new List<Pipelines.ActionStep>();
|
||||
List<Pipelines.ActionStep> actions = new();
|
||||
actions.Add(new Pipelines.ActionStep()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
|
||||
Reference in New Issue
Block a user