public void ContinuesIfMigrationFails() { Document <Entity>().With(x => x.Number); store.Initialize(); var id = NewId(); using (var session = store.OpenSession()) { session.Store(new Entity { Id = id }); session.SaveChanges(); } Reset(); Document <Entity>().With(x => x.Number); var logEventSink = new ListSink(); UseLogger(new LoggerConfiguration().WriteTo.Sink(logEventSink).CreateLogger()); store.Initialize(); UseMigrations(new InlineMigration(1, new ChangeDocument <Entity>((x, y) => { throw new Exception(); }))); Should.NotThrow(() => { new DocumentMigrationRunner().Run(store).Wait(1000); }); var numberOfRetries = logEventSink.Captures.Count(x => x == $"Error while migrating document of type \"HybridDb.Tests.HybridDbTests+Entity\" with id \"{id}\"."); // it has a back off of 100ms numberOfRetries.ShouldBeLessThan(12); numberOfRetries.ShouldBeGreaterThan(8); }
public void ContinuesIfMigrationFails() { Document<Entity>().With(x => x.Number); store.Initialize(); var id = NewId(); using (var session = store.OpenSession()) { session.Store(new Entity { Id = id }); session.SaveChanges(); } Reset(); Document<Entity>().With(x => x.Number); var logEventSink = new ListSink(); UseLogger(new LoggerConfiguration().WriteTo.Sink(logEventSink).CreateLogger()); store.Initialize(); UseMigrations(new InlineMigration(1, new ChangeDocument<Entity>((x, y) => { throw new Exception(); }))); Should.NotThrow(() => { new DocumentMigrationRunner().Run(store).Wait(1000); }); var numberOfRetries = logEventSink.Captures.Count(x => x == $"Error while migrating document of type \"HybridDb.Tests.HybridDbTests+Entity\" with id \"{id}\"."); // it has a back off of 100ms numberOfRetries.ShouldBeLessThan(12); numberOfRetries.ShouldBeGreaterThan(8); }