diff --git a/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs b/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs index 725b68eb20..2e3cb9fab0 100644 --- a/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs +++ b/NzbDrone.Services/NzbDrone.Services.Service/Controllers/ExceptionController.cs @@ -33,6 +33,7 @@ public EmptyResult ReportExisting(ExistingExceptionReport existingExceptionRepor ExceptionHash = existingExceptionReport.Hash, IsProduction = existingExceptionReport.IsProduction, LogMessage = existingExceptionReport.LogMessage, + UGuid = existingExceptionReport.UGuid, Timestamp = DateTime.Now }; @@ -64,7 +65,8 @@ public JsonResult ReportNew(ExceptionReport exceptionReport) ExceptionHash = exceptionHash, IsProduction = exceptionReport.IsProduction, LogMessage = exceptionReport.LogMessage, - Timestamp = DateTime.Now + Timestamp = DateTime.Now, + UGuid = exceptionReport.UGuid }; _database.Insert(exceptionInstance); diff --git a/NzbDrone.Services/NzbDrone.Services.Service/Migrations/Migration20120229.cs b/NzbDrone.Services/NzbDrone.Services.Service/Migrations/Migration20120229.cs index edb1419bb8..751a823728 100644 --- a/NzbDrone.Services/NzbDrone.Services.Service/Migrations/Migration20120229.cs +++ b/NzbDrone.Services/NzbDrone.Services.Service/Migrations/Migration20120229.cs @@ -14,6 +14,7 @@ public override void Up() new Column("ExceptionHash", DbType.String, ColumnProperty.NotNull), new Column("LogMessage", DbType.String, 3000, ColumnProperty.NotNull), MigrationsHelper.TimestampColumn, + MigrationsHelper.UGuidColumn, MigrationsHelper.ProductionColumn); Database.AddTable("Exceptions", new Column("Hash", DbType.String, ColumnProperty.Unique), diff --git a/NzbDrone.Services/NzbDrone.Services.Service/Repository/Reporting/ExceptionInstance.cs b/NzbDrone.Services/NzbDrone.Services.Service/Repository/Reporting/ExceptionInstance.cs index 9d2e4a2173..0832433704 100644 --- a/NzbDrone.Services/NzbDrone.Services.Service/Repository/Reporting/ExceptionInstance.cs +++ b/NzbDrone.Services/NzbDrone.Services.Service/Repository/Reporting/ExceptionInstance.cs @@ -12,5 +12,6 @@ public class ExceptionInstance public string LogMessage { get; set; } public DateTime Timestamp { get; set; } public bool IsProduction { get; set; } + public Guid UGuid { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs index fe16b03f36..87cdd26c27 100644 --- a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs +++ b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportExistingFixture.cs @@ -53,13 +53,21 @@ public void should_save_instance_if_hash_is_valid() WithRealDb(); var existing = CreateExceptionReport(); + Db.Insert(Builder.CreateNew().With(c => c.Hash = existing.Hash).Build()); - - Controller.ReportExisting(CreateExceptionReport()); + + Controller.ReportExisting(existing); Db.Fetch().Should().HaveCount(1); - Db.Fetch().Should().HaveCount(1); + var exceptionInstance = Db.Fetch(); + exceptionInstance.Should().HaveCount(1); + exceptionInstance.Single().Id.Should().BeGreaterThan(0); + exceptionInstance.Single().ExceptionHash.Should().NotBeBlank(); + exceptionInstance.Single().IsProduction.Should().Be(existing.IsProduction); + exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now); + exceptionInstance.Single().LogMessage.Should().Be(existing.LogMessage); + exceptionInstance.Single().UGuid.Should().Be(existing.UGuid); } } diff --git a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs index a2658b0ef9..2e96d18b45 100644 --- a/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs +++ b/NzbDrone.Services/NzbDrone.Services.Tests/ExceptionControllerTests/ReportNewFixture.cs @@ -92,6 +92,7 @@ public void ReportNew_should_save_instance() exceptionInstance.Single().IsProduction.Should().Be(exceptionReport.IsProduction); exceptionInstance.Single().Timestamp.Should().BeWithin(TimeSpan.FromSeconds(4)).Before(DateTime.Now); exceptionInstance.Single().LogMessage.Should().Be(exceptionReport.LogMessage); + exceptionInstance.Single().UGuid.Should().Be(exceptionReport.UGuid); } [Test]