cs-codex-dist-tests/Core/ToolsProvider.cs

50 lines
1.6 KiB
C#
Raw Normal View History

2023-09-13 08:03:11 +00:00
using FileUtils;
using KubernetesWorkflow;
using Logging;
using Utils;
namespace Core
{
public class ToolsProvider : IPluginTools
{
private readonly ILog log;
private readonly ITimeSet timeSet;
private readonly WorkflowCreator workflowCreator;
private readonly IFileManager fileManager;
public ToolsProvider(ILog log, Configuration configuration, string fileManagerRootFolder, ITimeSet timeSet)
{
this.log = log;
this.timeSet = timeSet;
fileManager = new FileManager(log, fileManagerRootFolder);
workflowCreator = new WorkflowCreator(log, configuration);
}
public Http CreateHttp(Address address, string baseUrl, Action<HttpClient> onClientCreated, string? logAlias = null)
{
return new Http(log, timeSet, address, baseUrl, onClientCreated, logAlias);
}
public Http CreateHttp(Address address, string baseUrl, string? logAlias = null)
{
return new Http(log, timeSet, address, baseUrl, logAlias);
}
public IStartupWorkflow CreateWorkflow(string? namespaceOverride = null)
{
if (namespaceOverride != null) throw new Exception("Namespace override is not supported in the DistTest environment. (It would mess up automatic resource cleanup.)");
return workflowCreator.CreateWorkflow();
}
public IFileManager GetFileManager()
{
return fileManager;
}
public ILog GetLog()
{
return log;
}
}
}