protected string NewDataPath([CallerMemberName] string prefix = null, bool forceCreateDir = false) { var path = RavenTestHelper.NewDataPath(prefix, 9999, forceCreateDir); _pathsToDelete.Add(path); return(path); }
protected string NewDataPath([CallerMemberName] string prefix = null, string suffix = null, bool forceCreateDir = false) { if (suffix != null) { prefix += suffix; } var path = RavenTestHelper.NewDataPath(prefix, NonReusedServerPort, forceCreateDir); PathsToDelete.Add(path); return(path); }
protected string NewDataPath([CallerMemberName] string prefix = null, string suffix = null, bool forceCreateDir = false) { if (suffix != null) { prefix += suffix; } var path = RavenTestHelper.NewDataPath(prefix, _serverCounter, forceCreateDir); GlobalPathsToDelete.Add(path); _localPathsToDelete.Add(path); return(path); }
static TestBase() { IgnoreProcessorAffinityChanges(ignore: true); EncryptionBuffersPool.Instance.Disabled = true; NativeMemory.GetCurrentUnmanagedThreadId = () => (ulong)Pal.rvn_get_current_thread_id(); var packagesPath = new PathSetting(RavenTestHelper.NewDataPath("NuGetPackages", 0, forceCreateDir: true)); GlobalPathsToDelete.Add(packagesPath.FullPath); MultiSourceNuGetFetcher.Instance.Initialize(packagesPath, "https://api.nuget.org/v3/index.json"); #if DEBUG2 TaskScheduler.UnobservedTaskException += (sender, args) => { if (args.Observed) { return; } var e = args.Exception.ExtractSingleInnerException(); var sb = new StringBuilder(); sb.AppendLine("===== UNOBSERVED TASK EXCEPTION ====="); sb.AppendLine(e.ExceptionToString(null)); sb.AppendLine("====================================="); Console.WriteLine(sb.ToString()); }; #endif if (PlatformDetails.RunningOnPosix == false && PlatformDetails.Is32Bits) // RavenDB-13655 { ThreadPool.SetMinThreads(25, 25); ThreadPool.SetMaxThreads(125, 125); } else { ThreadPool.SetMinThreads(250, 250); } RequestExecutor.RemoteCertificateValidationCallback += (sender, cert, chain, errors) => true; var maxNumberOfConcurrentTests = Math.Max(ProcessorInfo.ProcessorCount / 2, 2); if (int.TryParse(Environment.GetEnvironmentVariable("RAVEN_MAX_RUNNING_TESTS"), out var maxRunningTests)) { maxNumberOfConcurrentTests = maxRunningTests; } else { var fileInfo = new FileInfo(XunitConfigurationFile); if (fileInfo.Exists) { using (var file = File.OpenRead(XunitConfigurationFile)) using (var sr = new StreamReader(file)) { var json = JObject.Parse(sr.ReadToEnd()); if (json.TryGetValue("maxRunningTests", out var testsToken)) { maxNumberOfConcurrentTests = testsToken.Value <int>(); } else if (json.TryGetValue("maxParallelThreads", out var threadsToken)) { maxNumberOfConcurrentTests = threadsToken.Value <int>(); } } } } Console.WriteLine("Max number of concurrent tests is: " + maxNumberOfConcurrentTests); ConcurrentTestsSemaphore = new SemaphoreSlim(maxNumberOfConcurrentTests, maxNumberOfConcurrentTests); }
static unsafe TestBase() { IgnoreProcessorAffinityChanges(ignore: true); LicenseManager.AddLicenseStatusToLicenseLimitsException = true; RachisStateMachine.EnableDebugLongCommit = true; NativeMemory.GetCurrentUnmanagedThreadId = () => (ulong)Pal.rvn_get_current_thread_id(); ZstdLib.CreateDictionaryException = message => new VoronErrorException(message); Lucene.Net.Util.UnmanagedStringArray.Segment.AllocateMemory = NativeMemory.AllocateMemory; Lucene.Net.Util.UnmanagedStringArray.Segment.FreeMemory = NativeMemory.Free; BackupTask.DateTimeFormat = "yyyy-MM-dd-HH-mm-ss-fffffff"; RestorePointsBase.BackupFolderRegex = new Regex(@"([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}(-[0-9]{2}-[0-9]{7})?).ravendb-(.+)-([A-Za-z]+)-(.+)$", RegexOptions.Compiled); RestorePointsBase.FileNameRegex = new Regex(@"([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}(-[0-9]{2}-[0-9]{7})?)", RegexOptions.Compiled); var packagesPath = new PathSetting(RavenTestHelper.NewDataPath("NuGetPackages", 0, forceCreateDir: true)); GlobalPathsToDelete.Add(packagesPath.FullPath); MultiSourceNuGetFetcher.Instance.Initialize(packagesPath, "https://api.nuget.org/v3/index.json"); #if DEBUG2 TaskScheduler.UnobservedTaskException += (sender, args) => { if (args.Observed) { return; } var e = args.Exception.ExtractSingleInnerException(); var sb = new StringBuilder(); sb.AppendLine("===== UNOBSERVED TASK EXCEPTION ====="); sb.AppendLine(e.ExceptionToString(null)); sb.AppendLine("====================================="); Console.WriteLine(sb.ToString()); }; #endif if (PlatformDetails.RunningOnPosix == false && PlatformDetails.Is32Bits) // RavenDB-13655 { ThreadPool.SetMinThreads(25, 25); ThreadPool.SetMaxThreads(125, 125); } else { ThreadPool.SetMinThreads(250, 250); } RequestExecutor.RemoteCertificateValidationCallback += (sender, cert, chain, errors) => true; var maxNumberOfConcurrentTests = Math.Max(ProcessorInfo.ProcessorCount / 2, 2); if (int.TryParse(Environment.GetEnvironmentVariable("RAVEN_MAX_RUNNING_TESTS"), out var maxRunningTests)) { maxNumberOfConcurrentTests = maxRunningTests; } else { var fileInfo = new FileInfo(XunitConfigurationFile); if (fileInfo.Exists) { using (var file = File.OpenRead(XunitConfigurationFile)) using (var sr = new StreamReader(file)) { var json = JObject.Parse(sr.ReadToEnd()); if (json.TryGetValue("maxRunningTests", out var testsToken)) { maxNumberOfConcurrentTests = testsToken.Value <int>(); } else if (json.TryGetValue("maxParallelThreads", out var threadsToken)) { maxNumberOfConcurrentTests = threadsToken.Value <int>(); } } } } Console.WriteLine("Max number of concurrent tests is: " + maxNumberOfConcurrentTests); ConcurrentTestsSemaphore = new SemaphoreSlim(maxNumberOfConcurrentTests, maxNumberOfConcurrentTests); }