Errors running Integration Tests with RavenDB Embedded

47 views
Skip to first unread message

Kent Cooper

unread,
Apr 14, 2017, 12:51:47 AM4/14/17
to RavenDB - 2nd generation document database
I just updated to vs2017 and the latest version of Raven 3.5(v3.5.30) so I'm not sure which one caused this problem but now when I try to run my tests they fail with the following error

Message: Assembly Initialization method Api.Tests.TestHost.Setup threw exception. System.TypeLoadException: System.TypeLoadException: Could not load type 'Jint.Native.JsValue' from assembly 'Raven.Database, Version=3.5.3.0, Culture=neutral, PublicKeyToken=37f41c7f99471593' due to value type mismatch.. Aborting test execution.

 Stack trace of the error:
at Raven.Database.DocumentDatabase.DocumentDatabaseInitializer.ExecuteAlterConfiguration() in C:\Builds\RavenDB-Stable-3.5\Raven.Database\DocumentDatabase.cs:line 1467 at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration, DocumentDatabase systemDatabase, TransportState recievedTransportState) in C:\Builds\RavenDB-Stable-3.5\Raven.Database\DocumentDatabase.cs:line 144 at Raven.Database.Server.RavenDBOptions..ctor(InMemoryRavenConfiguration configuration, DocumentDatabase db) in C:\Builds\RavenDB-Stable-3.5\Raven.Database\Server\RavenDBOptions.cs:line 84 at Raven.Database.Server.Startup..ctor(InMemoryRavenConfiguration config, DocumentDatabase db) in C:\Builds\RavenDB-Stable-3.5\Raven.Database\Server\Startup.cs:line 12 at Raven.Database.Server.OwinHttpServer..ctor(InMemoryRavenConfiguration config, DocumentDatabase db, Boolean useHttpServer, Action`1 configure) in C:\Builds\RavenDB-Stable-3.5\Raven.Database\Server\OwinHttpServer.cs:line 24 at Raven.Server.RavenDbServer.Initialize(Action`1 configure) in C:\Builds\RavenDB-Stable-3.5\Raven.Database\Server\RavenDbServer.cs:line 131 at Raven.Database.Client.EmbeddedDocumentStore.Initialize() in C:\Builds\RavenDB-Stable-3.5\Raven.Database\Client\EmbeddedDocumentStore.cs:line 242 at Raven.Client.Embedded.EmbeddableDocumentStore.Initialize() in C:\Builds\RavenDB-Stable-3.5\Raven.Database\Client\EmbeddableDocumentStore.cs:line 153 at Api.Tests.Data.EmbeddedRavenDatabase.<>c.<.cctor>b__6_0() in C:\a\1\s\Src\Api.Tests\Data\EmbeddedRavenDatabase.cs:line 34 at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at Api.Tests.Data.EmbeddedRavenDatabase.get_Store() in C:\a\1\s\Src\Api.Tests\Data\EmbeddedRavenDatabase.cs:line 21 at Api.Tests.TestHost.<>c.<Setup>b__4_0(IAppBuilder app) in C:\a\1\s\Src\Api.Tests\TestHost.cs:line 66 at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context) at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context) at Microsoft.Owin.Testing.TestServer.Configure(Action`1 startup, StartOptions options) at Microsoft.Owin.Testing.TestServer.Configure(Action`1 startup) at Microsoft.Owin.Testing.TestServer.Create(Action`1 startup) at Api.Tests.TestHost.Setup(TestContext testContext) in C:\a\1\s\Src\.Api.Tests\TestHost.cs:line 43

Here's the code I use to configure the database:

public class EmbeddedRavenDatabase : IRavenDatabase
   
{
       
private static bool _configured = false;
 
       
public IDocumentStore Store
       
{
           
get
           
{
               
return _lazyDocStore.Value;
           
}
       
}
 
       
private static readonly Lazy<IDocumentStore> _lazyDocStore = new Lazy<IDocumentStore>(() =>
                                                                       
{
                                                                           
var docStore = new EmbeddableDocumentStore
                                                                           
{
                                                                               
RunInMemory = true,
                                                                           
};
                                                                           docStore
.Configuration.Storage.Voron
                                                                               
.AllowOn32Bits = true;
                                                                           docStore
.RegisterListener(new NoStaleQueriesAllowed());
                                                                           docStore
.Initialize();
 
                                                                           
if (!_configured)
                                                                           
{
                                                                               
var complete = CreateIndexes(docStore).Result;
                                                                           
}
 
                                                                           
return docStore;
                                                                       
});
 
       
private static async Task<bool> CreateIndexes(IDocumentStore docStore)
       
{
           
CreateApiClients.AddTestClient = true;
           
var indexTask = IndexCreation.CreateIndexesAsync(typeof(RavenDatabase).Assembly, docStore);
           
var seedTask = CreateApiClients.Seed(docStore);
           
var appTask = CreateApplication.Seed(docStore);
           
var timezoneTask = CreateTimeZones.Seed(docStore);
 
           
await Task.WhenAll(indexTask, seedTask, appTask, timezoneTask);
 
 
           
LogManager.RegisterTarget<RavenDebugTarget>();
           _configured
= true;
 
           
return true;
       
}
   
}


Any help figuring out this error would be appreciated. Also not sure if it matters but the project that is being tested also has a reference to jint(vs2.10)

Thanks,
Kent

Paweł Pekról

unread,
Apr 18, 2017, 4:04:20 AM4/18/17
to RavenDB - 2nd generation document database
Hi Kent,

RavenDB embedds it's own version of Jint so the version that you are using conflicts the one that is used internally. If possible please reference https://github.com/ravendb/ravendb/blob/v3.5/SharedLibs/Jint.dll (this is 2.8 with one minor feature added: ability to turn on NullPropagation which is turned off by default IIRC).

With regards,
P.
Reply all
Reply to author
Forward
0 new messages