protected async Task <ProcessNode> GetServerAsync( string serverVersion, InterversionTestOptions options = null, [CallerMemberName] string database = null, CancellationToken token = default) { var serverBuildInfo = ServerBuildDownloadInfo.Create(serverVersion); var serverPath = await _serverBuildRetriever.GetServerPath(serverBuildInfo, token); var testServerPath = NewDataPath(prefix: serverVersion); CopyFilesRecursively(new DirectoryInfo(serverPath), new DirectoryInfo(testServerPath)); var locator = new ConfigurableRavenServerLocator(Path.Combine(testServerPath, "Server"), serverVersion); var result = await RunServer(locator); return(new ProcessNode { Process = result.ServerProcess, Url = result.ServerUrl, Version = serverVersion, ServerPath = testServerPath, DataDir = locator.DataDir }); }
protected async Task UpgradeServerAsync( string toVersion, ProcessNode node, CancellationToken token = default) { KillSlavedServerProcess(node.Process); if (toVersion == "current") { RunLocalServer(node); return; } var serverBuildInfo = ServerBuildDownloadInfo.Create(toVersion); var serverPath = await _serverBuildRetriever.GetServerPath(serverBuildInfo, token); CopyFilesRecursively(new DirectoryInfo(serverPath), new DirectoryInfo(node.ServerPath)); var locator = new ConfigurableRavenServerLocator(Path.Combine(node.ServerPath, "Server"), toVersion, node.DataDir, node.Url); var result = await RunServer(locator); Assert.Equal(node.Url, result.ServerUrl); node.Process = result.ServerProcess; node.Version = toVersion; }
protected async Task <(Uri ServerUrl, Process ServerProcess)> GetServerAsync( string serverVersion, InterversionTestOptions options = null, [CallerMemberName] string database = null, CancellationToken token = default(CancellationToken)) { var serverBuildInfo = ServerBuildDownloadInfo.Create(serverVersion); var serverPath = await _serverBuildRetriever.GetServerPath(serverBuildInfo); var testServerPath = NewDataPath(prefix: serverVersion); CopyFilesRecursively(new DirectoryInfo(serverPath), new DirectoryInfo(testServerPath)); var locator = new ConfigurableRavenServerLocator(testServerPath); return(await RunServer(locator)); }
protected async Task <DocumentStore> GetDocumentStoreAsync( string serverVersion, InterversionTestOptions options = null, [CallerMemberName] string database = null, CancellationToken token = default) { var serverBuildInfo = ServerBuildDownloadInfo.Create(serverVersion); var serverPath = await _serverBuildRetriever.GetServerPath(serverBuildInfo, token); var testServerPath = NewDataPath(prefix: serverVersion); CopyFilesRecursively(new DirectoryInfo(serverPath), new DirectoryInfo(testServerPath)); var locator = new ConfigurableRavenServerLocator(testServerPath); var(serverUrl, serverProcess) = await RunServer(locator); options = options ?? InterversionTestOptions.Default; var name = GetDatabaseName(database); if (options.ModifyDatabaseName != null) { name = options.ModifyDatabaseName(name) ?? name; } var doc = new DatabaseRecord(name) { Settings = { [RavenConfiguration.GetKey(x => x.Replication.ReplicationMinimalHeartbeat)] = "1", [RavenConfiguration.GetKey(x => x.Replication.RetryReplicateAfter)] = "1", [RavenConfiguration.GetKey(x => x.Core.RunInMemory)] = "true", [RavenConfiguration.GetKey(x => x.Core.ThrowIfAnyIndexCannotBeOpened)] = "true", [RavenConfiguration.GetKey(x => x.Indexing.MinNumberOfMapAttemptsAfterWhichBatchWillBeCanceledIfRunningLowOnMemory)] = int.MaxValue.ToString() } }; options.ModifyDatabaseRecord?.Invoke(doc); var store = new DocumentStore { Urls = new[] { serverUrl.ToString() }, Database = name }; options.ModifyDocumentStore?.Invoke(store); store.Initialize(); if (options.CreateDatabase) { await store.Maintenance.Server.SendAsync(new CreateDatabaseOperation(doc, options.ReplicationFactor), token); } store.AfterDispose += (sender, e) => { KillSlavedServerProcess(serverProcess); }; return(store); }