mirror of
https://github.com/actions/runner.git
synced 2026-01-04 00:49:04 +08:00
delete un-used code. (#218)
This commit is contained in:
@@ -203,12 +203,9 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
// 1. Job request message (with ACTIONS_STEP_DEBUG = true)
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
JobEnvironment environment = new JobEnvironment();
|
||||
environment.SystemConnection = new ServiceEndpoint();
|
||||
List<TaskInstance> tasks = new List<TaskInstance>();
|
||||
Guid JobId = Guid.NewGuid();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = Pipelines.AgentJobRequestMessageUtil.Convert(new AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, environment, tasks));
|
||||
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);
|
||||
jobRequest.Resources.Repositories.Add(new Pipelines.RepositoryResource()
|
||||
{
|
||||
Alias = Pipelines.PipelineConstants.SelfAlias,
|
||||
|
||||
@@ -23,12 +23,9 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
JobEnvironment environment = new JobEnvironment();
|
||||
environment.SystemConnection = new ServiceEndpoint();
|
||||
List<TaskInstance> tasks = new List<TaskInstance>();
|
||||
Guid JobId = Guid.NewGuid();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = Pipelines.AgentJobRequestMessageUtil.Convert(new AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, environment, tasks));
|
||||
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);
|
||||
jobRequest.Resources.Repositories.Add(new Pipelines.RepositoryResource()
|
||||
{
|
||||
Alias = Pipelines.PipelineConstants.SelfAlias,
|
||||
@@ -102,12 +99,9 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
JobEnvironment environment = new JobEnvironment();
|
||||
environment.SystemConnection = new ServiceEndpoint();
|
||||
List<TaskInstance> tasks = new List<TaskInstance>();
|
||||
Guid JobId = Guid.NewGuid();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = Pipelines.AgentJobRequestMessageUtil.Convert(new AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, environment, tasks));
|
||||
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);
|
||||
jobRequest.Resources.Repositories.Add(new Pipelines.RepositoryResource()
|
||||
{
|
||||
Alias = Pipelines.PipelineConstants.SelfAlias,
|
||||
@@ -156,12 +150,9 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
// Arrange: Create a job request message.
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new TimelineReference();
|
||||
JobEnvironment environment = new JobEnvironment();
|
||||
environment.SystemConnection = new ServiceEndpoint();
|
||||
List<TaskInstance> tasks = new List<TaskInstance>();
|
||||
Guid JobId = Guid.NewGuid();
|
||||
Guid jobId = Guid.NewGuid();
|
||||
string jobName = "some job name";
|
||||
var jobRequest = Pipelines.AgentJobRequestMessageUtil.Convert(new AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, environment, tasks));
|
||||
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);
|
||||
jobRequest.Resources.Repositories.Add(new Pipelines.RepositoryResource()
|
||||
{
|
||||
Alias = Pipelines.PipelineConstants.SelfAlias,
|
||||
@@ -256,10 +247,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
configurationStore.Setup(x => x.GetSettings()).Returns(new RunnerSettings());
|
||||
hc.SetSingleton(configurationStore.Object);
|
||||
|
||||
// Arrange: Setup the cert configation.
|
||||
var cert = new Mock<IRunnerCertificateManager>();
|
||||
hc.SetSingleton(cert.Object);
|
||||
|
||||
// Arrange: Create the execution context.
|
||||
hc.SetSingleton(new Mock<IJobServerQueue>().Object);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
private Mock<IPipelineDirectoryManager> _directoryManager;
|
||||
private Mock<IActionManager> _actionManager;
|
||||
private Mock<IJobServerQueue> _jobServerQueue;
|
||||
private Mock<IRunnerCertificateManager> _cert;
|
||||
private Mock<IConfigurationStore> _config;
|
||||
private Mock<IPagingLogger> _logger;
|
||||
private Mock<IExpressionManager> _express;
|
||||
@@ -36,7 +35,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
_jobServerQueue = new Mock<IJobServerQueue>();
|
||||
_config = new Mock<IConfigurationStore>();
|
||||
_logger = new Mock<IPagingLogger>();
|
||||
_cert = new Mock<IRunnerCertificateManager>();
|
||||
_express = new Mock<IExpressionManager>();
|
||||
_containerProvider = new Mock<IContainerOperationProvider>();
|
||||
_diagnosticLogManager = new Mock<IDiagnosticLogManager>();
|
||||
@@ -110,7 +108,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
hc.SetSingleton(_actionManager.Object);
|
||||
hc.SetSingleton(_config.Object);
|
||||
hc.SetSingleton(_jobServerQueue.Object);
|
||||
hc.SetSingleton(_cert.Object);
|
||||
hc.SetSingleton(_express.Object);
|
||||
hc.SetSingleton(_containerProvider.Object);
|
||||
hc.SetSingleton(_directoryManager.Object);
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
private CancellationTokenSource _tokenSource;
|
||||
private Mock<IJobServer> _jobServer;
|
||||
private Mock<IJobServerQueue> _jobServerQueue;
|
||||
private Mock<IRunnerCertificateManager> _cert;
|
||||
private Mock<IConfigurationStore> _config;
|
||||
private Mock<IExtensionManager> _extensions;
|
||||
private Mock<IStepsRunner> _stepRunner;
|
||||
@@ -42,7 +41,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
_jobExtension = new Mock<IJobExtension>();
|
||||
_jobServer = new Mock<IJobServer>();
|
||||
_jobServerQueue = new Mock<IJobServerQueue>();
|
||||
_cert = new Mock<IRunnerCertificateManager>();
|
||||
_stepRunner = new Mock<IStepsRunner>();
|
||||
_logger = new Mock<IPagingLogger>();
|
||||
_temp = new Mock<ITempDirectoryManager>();
|
||||
@@ -64,22 +62,23 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
|
||||
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
|
||||
TimelineReference timeline = new Timeline(Guid.NewGuid());
|
||||
JobEnvironment environment = new JobEnvironment();
|
||||
environment.Variables[Constants.Variables.System.Culture] = "en-US";
|
||||
environment.SystemConnection = new ServiceEndpoint()
|
||||
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);
|
||||
_message.Variables[Constants.Variables.System.Culture] = "en-US";
|
||||
_message.Resources.Endpoints.Add(new ServiceEndpoint()
|
||||
{
|
||||
Name = WellKnownServiceEndpointNames.SystemVssConnection,
|
||||
Url = new Uri("https://test.visualstudio.com"),
|
||||
Authorization = new EndpointAuthorization()
|
||||
{
|
||||
Scheme = "Test",
|
||||
}
|
||||
};
|
||||
environment.SystemConnection.Authorization.Parameters["AccessToken"] = "token";
|
||||
Parameters = {
|
||||
{"AccessToken", "token"}
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
List<TaskInstance> tasks = new List<TaskInstance>();
|
||||
Guid JobId = Guid.NewGuid();
|
||||
_message = Pipelines.AgentJobRequestMessageUtil.Convert(new AgentJobRequestMessage(plan, timeline, JobId, testName, testName, environment, tasks));
|
||||
_message.Resources.Repositories.Add(new Pipelines.RepositoryResource()
|
||||
{
|
||||
Alias = Pipelines.PipelineConstants.SelfAlias,
|
||||
@@ -109,7 +108,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
hc.SetSingleton(_config.Object);
|
||||
hc.SetSingleton(_jobServer.Object);
|
||||
hc.SetSingleton(_jobServerQueue.Object);
|
||||
hc.SetSingleton(_cert.Object);
|
||||
hc.SetSingleton(_stepRunner.Object);
|
||||
hc.SetSingleton(_extensions.Object);
|
||||
hc.SetSingleton(_temp.Object);
|
||||
|
||||
@@ -16,13 +16,11 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
{
|
||||
private Mock<IProcessChannel> _processChannel;
|
||||
private Mock<IJobRunner> _jobRunner;
|
||||
private Mock<IRunnerCertificateManager> _cert;
|
||||
|
||||
public WorkerL0()
|
||||
{
|
||||
_processChannel = new Mock<IProcessChannel>();
|
||||
_jobRunner = new Mock<IJobRunner>();
|
||||
_cert = new Mock<IRunnerCertificateManager>();
|
||||
}
|
||||
|
||||
private Pipelines.AgentJobRequestMessage CreateJobRequestMessage(string jobName)
|
||||
@@ -37,15 +35,15 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
serviceEndpoint.Authorization.Parameters.Add("nullValue", null);
|
||||
resources.Endpoints.Add(serviceEndpoint);
|
||||
|
||||
List<Pipelines.JobStep> tasks = new List<Pipelines.JobStep>();
|
||||
tasks.Add(new Pipelines.TaskStep()
|
||||
List<Pipelines.ActionStep> actions = new List<Pipelines.ActionStep>();
|
||||
actions.Add(new Pipelines.ActionStep()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Reference = new Pipelines.TaskStepDefinitionReference()
|
||||
Reference = new Pipelines.RepositoryPathReference()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Name = "TestTask",
|
||||
Version = "1.0.0"
|
||||
RepositoryType = "GitHub",
|
||||
Name = "actions/test",
|
||||
Ref = "v1"
|
||||
}
|
||||
});
|
||||
Guid JobId = Guid.NewGuid();
|
||||
@@ -69,7 +67,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
new Pipelines.ContextData.DictionaryContextData()
|
||||
},
|
||||
};
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, new StringToken(null, null, null, "ubuntu"), sidecarContainers, null, variables, new List<MaskHint>(), resources, context, null, tasks, null);
|
||||
var jobRequest = new Pipelines.AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, new StringToken(null, null, null, "ubuntu"), sidecarContainers, null, variables, new List<MaskHint>(), resources, context, null, actions, null);
|
||||
return jobRequest;
|
||||
}
|
||||
|
||||
@@ -90,7 +88,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
var worker = new GitHub.Runner.Worker.Worker();
|
||||
hc.EnqueueInstance<IProcessChannel>(_processChannel.Object);
|
||||
hc.EnqueueInstance<IJobRunner>(_jobRunner.Object);
|
||||
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
|
||||
worker.Initialize(hc);
|
||||
var jobMessage = CreateJobRequestMessage("job1");
|
||||
var arWorkerMessages = new WorkerMessage[]
|
||||
@@ -142,7 +139,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
var worker = new GitHub.Runner.Worker.Worker();
|
||||
hc.EnqueueInstance<IProcessChannel>(_processChannel.Object);
|
||||
hc.EnqueueInstance<IJobRunner>(_jobRunner.Object);
|
||||
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
|
||||
worker.Initialize(hc);
|
||||
var jobMessage = CreateJobRequestMessage("job1");
|
||||
var cancelMessage = CreateJobCancelMessage(jobMessage.JobId);
|
||||
|
||||
Reference in New Issue
Block a user