public void Dispose() { if (PgServer != null) { PgServer.Stop(); } }
public Profile(PgServer pgServer) { this.pgServer = pgServer; var services = new ServiceCollection(); this.ServiceProvider = services.BuildServiceProvider(); }
public Fixture() { var usePgServerEnvironmentVariable = Environment.GetEnvironmentVariable("ALLORS_NPGSQL_USE_PGSERVER"); if (!bool.TryParse(usePgServerEnvironmentVariable, out var usePgServer)) { usePgServer = true; } if (usePgServer) { var pgServerParams = new Dictionary <string, string> { { "timezone", "UTC" }, { "synchronous_commit", "off" }, }; this.PgServer = new PgServer( pgVersion: "10.7.1", addLocalUserAccessPermission: true, // clearWorkingDirOnStart: true, pgServerParams: pgServerParams, locale: "English_Belgium.1252"); this.PgServer.Start(); } }
public EmbeddedDatabaseFixture() { PgServer = new PgServer(PostgreSQLVersion, port: Port, clearInstanceDirOnStop: true, addLocalUserAccessPermission: true); PgServer.Start(); }
public void Dispose() { try { if (PgServer != null) { PgServer.Stop(); } } catch (Exception) { } }
public EmbeddedDatabaseFixture() { var serverParams = new Dictionary <string, string>(); PgServer = new PgServer(PostgreSQLVersion, port: Port, clearInstanceDirOnStop: true, addLocalUserAccessPermission: true, instanceId: Guid.Empty, pgServerParams: serverParams); PgServer.Start(); }
public void Dispose() { this.PgServer?.Stop(); this.PgServer = null; }
public GameStatePostgreSQLRepository() { // THIS DOES NOT WORK. MysticMind.PostgresEmbed is for Windows ONLY :( _server = new MysticMind.PostgresEmbed.PgServer("9.5.5.1"); }
public async Task InitializeAsync() { bool useDefaultDirectory = false; if (bool.TryParse( Environment.GetEnvironmentVariable("urn:milou:deployer:web:tests:pgsql:AddLocalUserAccessPermission"), out bool addUser)) { AddLocalUserAccessPermission = addUser; } if (bool.TryParse( Environment.GetEnvironmentVariable("urn:milou:deployer:web:tests:pgsql:DefaultDirectory"), out bool useDefaultDirectoryEnabled)) { useDefaultDirectory = useDefaultDirectoryEnabled; } string version = Environment.GetEnvironmentVariable("urn:milou:deployer:web:tests:pgsql:version") .WithDefault("10.5.1"); DirectoryInfo postgresqlDbDir; if (useDefaultDirectory) { postgresqlDbDir = null; } else { postgresqlDbDir = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "tools", "MysticMind.PostgresEmbed", version)).EnsureExists(); } Console.WriteLine(typeof(MartenConfiguration)); Console.WriteLine(typeof(Milou.Deployer.Web.IisHost.Areas.Deployment.Controllers.DeployController)); try { try { _pgServer = new PgServer( version, PostgresqlUser, dbDir: postgresqlDbDir?.FullName ?? "", addLocalUserAccessPermission: AddLocalUserAccessPermission, clearInstanceDirOnStop: true); _pgServer.Start(); } finally { _cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(CancellationTimeoutInSeconds)); } string connStr = string.Format(ConnectionStringFormat, _pgServer.PgPort, PostgresqlUser); Environment.SetEnvironmentVariable("urn:milou:deployer:web:marten:singleton:connection-string", connStr); Environment.SetEnvironmentVariable("urn:milou:deployer:web:marten:singleton:enabled", "true"); await BeforeInitialize(_cancellationTokenSource.Token); IReadOnlyCollection <string> args = await RunSetupAsync(); if (CancellationToken.IsCancellationRequested) { throw new Core.DeployerAppException("The cancellation token is already cancelled, skipping before start"); } try { _diagnosticMessageSink.OnMessage(new DiagnosticMessage("Running before start")); await BeforeStartAsync(args); } catch (Exception ex) when(!ex.IsFatal()) { _diagnosticMessageSink.OnMessage(new DiagnosticMessage(ex.ToString())); _cancellationTokenSource.Cancel(); throw new Core.DeployerAppException("Before start exception", ex); } if (CancellationToken.IsCancellationRequested) { throw new Core.DeployerAppException("The cancellation token is already cancelled, skipping start"); } await StartAsync(args); await Task.Delay(TimeSpan.FromSeconds(1)); if (CancellationToken.IsCancellationRequested) { throw new Core.DeployerAppException("The cancellation token is already cancelled, skipping run"); } await RunAsync(); if (CancellationToken.IsCancellationRequested) { throw new Core.DeployerAppException("The cancellation token is already cancelled, skipping after run"); } await AfterRunAsync(); } catch (Exception ex) when(!ex.IsFatal()) { Exception = ex; OnException(ex); } }