delete un-used code. (#218)

This commit is contained in:
Tingluo Huang
2019-12-16 17:05:26 -05:00
committed by GitHub
parent c3c66bb14a
commit d0a4a41a63
582 changed files with 155 additions and 66274 deletions

View File

@@ -385,7 +385,7 @@ namespace GitHub.Runner.Common.Tests
[Fact]
[Trait("Level", "L0")]
[Trait("Category", nameof(CommandSettings))]
public void PromptsForPassword()
public void PromptsForRunnerRegisterToken()
{
using (TestHostContext hc = CreateTestContext())
{
@@ -393,46 +393,19 @@ namespace GitHub.Runner.Common.Tests
var command = new CommandSettings(hc, args: new string[0]);
_promptManager
.Setup(x => x.ReadValue(
Constants.Runner.CommandLine.Args.Password, // argName
"What is your GitHub password?", // description
Constants.Runner.CommandLine.Args.Token, // argName
"What is your runner register token?", // description
true, // secret
string.Empty, // defaultValue
Validators.NonEmptyValidator, // validator
false)) // unattended
.Returns("some password");
.Returns("some token");
// Act.
string actual = command.GetPassword();
string actual = command.GetRunnerRegisterToken();
// Assert.
Assert.Equal("some password", actual);
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", nameof(CommandSettings))]
public void PromptsForPool()
{
using (TestHostContext hc = CreateTestContext())
{
// Arrange.
var command = new CommandSettings(hc, args: new string[0]);
_promptManager
.Setup(x => x.ReadValue(
Constants.Runner.CommandLine.Args.Pool, // argName
"Enter the name of your runner pool:", // description
false, // secret
"default", // defaultValue
Validators.NonEmptyValidator, // validator
false)) // unattended
.Returns("some pool");
// Act.
string actual = command.GetPool();
// Assert.
Assert.Equal("some pool", actual);
Assert.Equal("some token", actual);
}
}
@@ -498,7 +471,7 @@ namespace GitHub.Runner.Common.Tests
_promptManager
.Setup(x => x.ReadValue(
Constants.Runner.CommandLine.Args.Token, // argName
"Enter your personal access token:", // description
"What is your pool admin oauth access token?", // description
true, // secret
string.Empty, // defaultValue
Validators.NonEmptyValidator, // validator
@@ -567,33 +540,6 @@ namespace GitHub.Runner.Common.Tests
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", nameof(CommandSettings))]
public void PromptsForUserName()
{
using (TestHostContext hc = CreateTestContext())
{
// Arrange.
var command = new CommandSettings(hc, args: new string[0]);
_promptManager
.Setup(x => x.ReadValue(
Constants.Runner.CommandLine.Args.UserName, // argName
"What is your GitHub username?", // description
false, // secret
string.Empty, // defaultValue
Validators.NonEmptyValidator, // validator
false)) // unattended
.Returns("some user name");
// Act.
string actual = command.GetUserName();
// Assert.
Assert.Equal("some user name", actual);
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", nameof(CommandSettings))]

View File

@@ -25,7 +25,7 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
{
using (TestHostContext hc = new TestHostContext(this))
{
Assert.True(Validators.AuthSchemeValidator("pat"));
Assert.True(Validators.AuthSchemeValidator("OAuth"));
Assert.False(Validators.AuthSchemeValidator("Fail"));
}
}
@@ -47,7 +47,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "ArgumentValidator")]
#endif
public void WindowsLogonAccountValidator()
{
using (TestHostContext hc = new TestHostContext(this))
@@ -56,5 +55,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
Assert.True(Validators.NTAccountValidator("NT AUTHORITY\\LOCAL SERVICE"));
}
}
#endif
}
}

View File

@@ -26,7 +26,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
private Mock<IPromptManager> _promptManager;
private Mock<IConfigurationStore> _store;
private Mock<IExtensionManager> _extnMgr;
private Mock<IRunnerCertificateManager> _cert;
#if OS_WINDOWS
private Mock<IWindowsServiceControlManager> _serviceControlManager;
@@ -44,7 +43,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
private string _expectedAuthType = "pat";
private string _expectedWorkFolder = "_work";
private int _expectedPoolId = 1;
private int _expectedDeploymentMachineId = 81;
private RSACryptoServiceProvider rsa = null;
private RunnerSettings _configMgrAgentSettings = new RunnerSettings();
@@ -57,7 +55,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
_store = new Mock<IConfigurationStore>();
_extnMgr = new Mock<IExtensionManager>();
_rsaKeyManager = new Mock<IRSAKeyManager>();
_cert = new Mock<IRunnerCertificateManager>();
#if OS_WINDOWS
_serviceControlManager = new Mock<IWindowsServiceControlManager>();
@@ -68,7 +65,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
#endif
var expectedAgent = new TaskAgent(_expectedAgentName) { Id = 1 };
var expectedDeploymentMachine = new DeploymentMachine() { Agent = expectedAgent, Id = _expectedDeploymentMachineId };
expectedAgent.Authorization = new TaskAgentAuthorization
{
ClientId = Guid.NewGuid(),
@@ -124,7 +120,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
tc.SetSingleton<IExtensionManager>(_extnMgr.Object);
tc.SetSingleton<IRunnerServer>(_runnerServer.Object);
tc.SetSingleton<ILocationServer>(_locationServer.Object);
tc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
#if OS_WINDOWS
tc.SetSingleton<IWindowsServiceControlManager>(_serviceControlManager.Object);
@@ -155,10 +150,7 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
tc,
new[]
{
"configure",
#if !OS_WINDOWS
"--acceptteeeula",
#endif
"configure",
"--url", _expectedServerUrl,
"--name", _expectedAgentName,
"--pool", _expectedPoolName,

View File

@@ -1,24 +1,24 @@
using GitHub.Runner.Listener;
using GitHub.Runner.Listener.Configuration;
using GitHub.Services.Client;
using GitHub.Services.Common;
using GitHub.Services.OAuth;
namespace GitHub.Runner.Common.Tests.Listener.Configuration
{
public class TestRunnerCredential : CredentialProvider
{
public TestRunnerCredential(): base("TEST") {}
public TestRunnerCredential() : base("TEST") { }
public override VssCredentials GetVssCredentials(IHostContext context)
{
Tracing trace = context.GetTrace("PersonalAccessToken");
Tracing trace = context.GetTrace("OuthAccessToken");
trace.Info("GetVssCredentials()");
VssBasicCredential loginCred = new VssBasicCredential("test", "password");
var loginCred = new VssOAuthAccessTokenCredential("sometoken");
VssCredentials creds = new VssCredentials(loginCred);
trace.Verbose("cred created");
return creds;
}
}
public override void EnsureCredential(IHostContext context, CommandSettings command, string serverUrl)
{
}

View File

@@ -32,11 +32,8 @@ namespace GitHub.Runner.Common.Tests.Listener
{
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
TimelineReference timeline = null;
JobEnvironment environment = new JobEnvironment();
List<TaskInstance> tasks = new List<TaskInstance>();
Guid JobId = Guid.NewGuid();
var jobRequest = new AgentJobRequestMessage(plan, timeline, JobId, "someJob", "someJob", environment, tasks);
var result = Pipelines.AgentJobRequestMessageUtil.Convert(jobRequest);
Guid jobId = Guid.NewGuid();
var result = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, "someJob", "someJob", 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);
result.ContextData["github"] = new Pipelines.ContextData.DictionaryContextData();
return result;
}

View File

@@ -160,7 +160,7 @@ namespace GitHub.Runner.Common.Tests.Listener
{
Body = "somebody1",
MessageId = 4234,
MessageType = JobRequestMessageTypes.AgentJobRequest
MessageType = JobRequestMessageTypes.PipelineAgentJobRequest
},
new TaskAgentMessage
{
@@ -174,7 +174,7 @@ namespace GitHub.Runner.Common.Tests.Listener
{
Body = "somebody3",
MessageId = 4236,
MessageType = JobRequestMessageTypes.AgentJobRequest
MessageType = JobRequestMessageTypes.PipelineAgentJobRequest
}
};
var messages = new Queue<TaskAgentMessage>(arMessages);

View File

@@ -23,7 +23,6 @@ namespace GitHub.Runner.Common.Tests.Listener
private Mock<IRunnerServer> _runnerServer;
private Mock<ITerminal> _term;
private Mock<IConfigurationStore> _configStore;
private Mock<IRunnerCertificateManager> _cert;
private Mock<ISelfUpdater> _updater;
public RunnerL0()
@@ -36,19 +35,15 @@ namespace GitHub.Runner.Common.Tests.Listener
_runnerServer = new Mock<IRunnerServer>();
_term = new Mock<ITerminal>();
_configStore = new Mock<IConfigurationStore>();
_cert = new Mock<IRunnerCertificateManager>();
_updater = new Mock<ISelfUpdater>();
}
private AgentJobRequestMessage CreateJobRequestMessage(string jobName)
private Pipelines.AgentJobRequestMessage CreateJobRequestMessage(string jobName)
{
TaskOrchestrationPlanReference plan = new TaskOrchestrationPlanReference();
TimelineReference timeline = null;
JobEnvironment environment = new JobEnvironment();
List<TaskInstance> tasks = new List<TaskInstance>();
Guid JobId = Guid.NewGuid();
var jobRequest = new AgentJobRequestMessage(plan, timeline, JobId, jobName, jobName, environment, tasks);
return jobRequest as AgentJobRequestMessage;
Guid jobId = Guid.NewGuid();
return 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(), new List<Pipelines.ActionStep>(), null);
}
private JobCancelMessage CreateJobCancelMessage()
@@ -72,7 +67,6 @@ namespace GitHub.Runner.Common.Tests.Listener
hc.SetSingleton<IMessageListener>(_messageListener.Object);
hc.SetSingleton<IPromptManager>(_promptManager.Object);
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
runner.Initialize(hc);
var settings = new RunnerSettings
@@ -177,7 +171,6 @@ namespace GitHub.Runner.Common.Tests.Listener
hc.SetSingleton<IConfigurationManager>(_configurationManager.Object);
hc.SetSingleton<IPromptManager>(_promptManager.Object);
hc.SetSingleton<IMessageListener>(_messageListener.Object);
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
var command = new CommandSettings(hc, args);
@@ -209,7 +202,6 @@ namespace GitHub.Runner.Common.Tests.Listener
hc.SetSingleton<IConfigurationManager>(_configurationManager.Object);
hc.SetSingleton<IPromptManager>(_promptManager.Object);
hc.SetSingleton<IMessageListener>(_messageListener.Object);
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
var command = new CommandSettings(hc, new[] { "run" });
@@ -247,7 +239,6 @@ namespace GitHub.Runner.Common.Tests.Listener
hc.SetSingleton<IMessageListener>(_messageListener.Object);
hc.SetSingleton<IPromptManager>(_promptManager.Object);
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
runner.Initialize(hc);
var settings = new RunnerSettings
@@ -337,7 +328,6 @@ namespace GitHub.Runner.Common.Tests.Listener
hc.SetSingleton<IMessageListener>(_messageListener.Object);
hc.SetSingleton<IPromptManager>(_promptManager.Object);
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
runner.Initialize(hc);
var settings = new RunnerSettings
@@ -434,7 +424,6 @@ namespace GitHub.Runner.Common.Tests.Listener
hc.SetSingleton<IMessageListener>(_messageListener.Object);
hc.SetSingleton<IPromptManager>(_promptManager.Object);
hc.SetSingleton<IRunnerServer>(_runnerServer.Object);
hc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
hc.SetSingleton<IConfigurationStore>(_configStore.Object);
hc.SetSingleton<ISelfUpdater>(_updater.Object);

View File

@@ -53,7 +53,7 @@ namespace GitHub.Runner.Common.Tests
Assert.Equal(1, stdout.Count);
Assert.Equal("From STDOUT 'ç'", stdout[0]);
Assert.True(stderr.Count > 0);
Assert.True(stderr[0].Contains("From STDERR 'ç'"));
Assert.Contains("From STDERR 'ç'", stderr[0]);
}
}
#endif

View File

@@ -72,8 +72,6 @@ namespace GitHub.Runner.Common.Tests
public CultureInfo DefaultCulture { get; private set; }
public RunMode RunMode { get; set; }
public string TraceFileName { get; private set; }
public StartupType StartupType

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);