Beispiel #1
0
        public NomadAgentProcess(NomadAgentConfiguration configuration, ITestOutputHelper output)
        {
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _output        = output ?? throw new ArgumentNullException(nameof(output));
            InitConfigFile();
            InitStartInfo();
            CleanDataDir();

            OutputDataReceived += NomadAgentProcess_OutputDataReceived;
            ErrorDataReceived  += NomadAgentProcess_ErrorDataReceived;
        }
        internal NomadAgentProcess NewServer(Action <NomadAgentConfiguration> configure = null)
        {
            var type   = GetType();
            var config = new NomadAgentConfiguration
            {
                Region  = "test-region",
                Name    = $"{type.Name}_{NomadAgentConfiguration.Count}",
                DataDir = $"{Path.GetTempPath()}nomaddir_{type.Name}_{NomadAgentConfiguration.Count}",
                Ports   = BasePorts.Add(NomadAgentConfiguration.Count),
            };

            configure?.Invoke(config);
            var process = new NomadAgentProcess(config, _output);

            process.Start();
            return(process);
        }