.NET: Reduce MemoryPolicyConfiguration.MaxSize for persistence tests as a workaround for OOM on default settings
namespace Apache.Ignite.Core.Tests.Cache
{
using System.IO;
+ using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.PersistentStore;
@@ -51,7 +52,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestCacheDataSurvivesNodeRestart()
{
- var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ var cfg = new IgniteConfiguration(GetTestConfiguration())
{
PersistentStoreConfiguration = new PersistentStoreConfiguration
{
@@ -106,7 +107,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGridActivationWithPersistence()
{
- var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ var cfg = new IgniteConfiguration(GetTestConfiguration())
{
PersistentStoreConfiguration = new PersistentStoreConfiguration()
};
@@ -177,5 +178,36 @@ namespace Apache.Ignite.Core.Tests.Cache
ex.Message.Substring(0, 62));
}
}
+
+ /// <summary>
+ /// Gets the test configuration.
+ /// </summary>
+ private static IgniteConfiguration GetTestConfiguration()
+ {
+ return new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ MemoryConfiguration = GetMemoryConfig()
+ };
+ }
+
+ /// <summary>
+ /// Gets the memory configuration with reduced MaxMemory to work around persistence bug.
+ /// </summary>
+ private static MemoryConfiguration GetMemoryConfig()
+ {
+ // TODO: Remove this method and use default config (IGNITE-5717).
+ return new MemoryConfiguration
+ {
+ MemoryPolicies = new[]
+ {
+ new MemoryPolicyConfiguration
+ {
+ Name = MemoryConfiguration.DefaultDefaultMemoryPolicyName,
+ InitialSize = 512*1024*1024,
+ MaxSize = 512*1024*1024
+ }
+ }
+ };
+ }
}
}
