Running Integration Tests against Postgres Database (#838)

* Allow configuring postgres with environment variables

(cherry picked from commit 8439df78fea25656a9a1275d2a2fe3f0df0528c7)

* Fix process provider when environment variables alread exist

[common]

(cherry picked from commit 66e5b4025974e081c1406f01a860b1ac52949c22)

* First bash at running integration tests on postgres

(cherry picked from commit f950e80c7e4f9b088ec6a149386160eab83b61c3)

* Postgres integration tests running as part of the build pipeline

(cherry picked from commit 9ca8616f5098778e9b5e6ce09d2aa11224018fab)

* Fixed: Register PostgresOptions when running in utility mode

* fixup!

* fixup!

* fixup!

* fixup!

* fixup!

Co-authored-by: ta264 <ta264@users.noreply.github.com>
Co-authored-by: Qstick <qstick@gmail.com>
This commit is contained in:
Robin Dadswell
2022-07-02 23:48:10 +01:00
committed by GitHub
parent 9b1f9abfac
commit cac2729230
23 changed files with 428 additions and 56 deletions

View File

@@ -4,11 +4,13 @@ using DryIoc.Microsoft.DependencyInjection;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Composition.Extensions;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Datastore.Extensions;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
@@ -29,7 +31,8 @@ namespace NzbDrone.Common.Test
.AddDummyDatabase()
.AddStartupContext(new StartupContext("first", "second"));
container.RegisterInstance<IHostLifetime>(new Mock<IHostLifetime>().Object);
container.RegisterInstance(new Mock<IHostLifetime>().Object);
container.RegisterInstance(new Mock<IOptions<PostgresOptions>>().Object);
var serviceProvider = container.GetServiceProvider();