Force Examine to run in sync for integration tests
This commit is contained in:
@@ -156,6 +156,7 @@ namespace Umbraco.Core.Composing
|
||||
"MiniProfiler.",
|
||||
"Owin,",
|
||||
"SQLite",
|
||||
"ReSharperTestRunner32" // used by resharper testrunner
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,9 +19,13 @@ namespace Umbraco.Examine
|
||||
/// <summary>
|
||||
/// An indexer for Umbraco content and media
|
||||
/// </summary>
|
||||
public class UmbracoContentIndex : UmbracoExamineIndex, IUmbracoContentIndex
|
||||
public class UmbracoContentIndex : UmbracoExamineIndex, IUmbracoContentIndex, IDisposable
|
||||
{
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
protected ILocalizationService LanguageService { get; }
|
||||
|
||||
#region Constructors
|
||||
|
||||
@@ -18,7 +18,7 @@ using Umbraco.Web.Models.ContentEditing;
|
||||
namespace Umbraco.Tests.Integration.TestServerTest.Controllers
|
||||
{
|
||||
[TestFixture]
|
||||
[Explicit("Need to figure out whats wrong with these tests when executed all in one run.")]
|
||||
//[Explicit("Need to figure out whats wrong with these tests when executed all in one run.")]
|
||||
public class ContentControllerTests : UmbracoTestServerTestBase
|
||||
{
|
||||
|
||||
|
||||
@@ -3,18 +3,20 @@ using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using Examine;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Examine;
|
||||
using Umbraco.Extensions;
|
||||
using Umbraco.Tests.Integration.Testing;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Common.Controllers;
|
||||
using Umbraco.Web.Editors;
|
||||
|
||||
|
||||
namespace Umbraco.Tests.Integration.TestServerTest
|
||||
@@ -23,6 +25,7 @@ namespace Umbraco.Tests.Integration.TestServerTest
|
||||
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest, Logger = UmbracoTestOptions.Logger.Console, Boot = false)]
|
||||
public abstract class UmbracoTestServerTestBase : UmbracoIntegrationTest
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -31,6 +34,21 @@ namespace Umbraco.Tests.Integration.TestServerTest
|
||||
AllowAutoRedirect = false
|
||||
});
|
||||
LinkGenerator = Factory.Services.GetRequiredService<LinkGenerator>();
|
||||
|
||||
ExecuteExamineIndexOperationsInSync();
|
||||
}
|
||||
|
||||
private void ExecuteExamineIndexOperationsInSync()
|
||||
{
|
||||
var examineManager = Factory.Services.GetRequiredService<IExamineManager>();
|
||||
|
||||
foreach (var index in examineManager.Indexes)
|
||||
{
|
||||
if (index is UmbracoExamineIndex umbracoExamineIndex)
|
||||
{
|
||||
umbracoExamineIndex.ProcessNonAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Examine.Lucene" Version="2.0.0-alpha.20200128.15" />
|
||||
<PackageReference Include="LightInject.Microsoft.DependencyInjection" Version="3.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.4" />
|
||||
|
||||
Reference in New Issue
Block a user