You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2019/06/10 18:45:21 UTC
[ignite] 02/02: Split tests by use cases
This is an automated email from the ASF dual-hosted git repository.
ptupitsyn pushed a commit to branch ignite-dotnet-hanging-test
in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 6aaaf41711d6f4353d79bc3a2665131ade8a2d74
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Jun 10 21:42:46 2019 +0300
Split tests by use cases
---
.../Apache.Ignite.Core.Tests/Plugin/PluginTest.cs | 64 +++++++++++++++-------
1 file changed, 45 insertions(+), 19 deletions(-)
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
index ffe2464..432c419 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
@@ -38,6 +38,14 @@ namespace Apache.Ignite.Core.Tests.Plugin
/** Plugin log. */
private static readonly List<string> PluginLog = new List<string>();
+ [TearDown]
+ public void TearDown()
+ {
+ // Verify ignite start-stop.
+ Ignition.Start(TestUtils.GetTestConfiguration());
+ Ignition.StopAll(true);
+ }
+
/// <summary>
/// Tests the plugin life cycle.
/// </summary>
@@ -175,29 +183,28 @@ namespace Apache.Ignite.Core.Tests.Plugin
"at org.apache.ignite.platform.plugin.PlatformTestPluginTarget.processInLongOutLong"));
}
- /// <summary>
- /// Tests invalid plugins.
- /// </summary>
[Test]
- public void TestInvalidPlugins()
+ public void IgnitionStart_MissingPluginConfigurationAtribute_ThrowsException()
{
- Action<ICollection<IPluginConfiguration>> check = x => Ignition.Start(
- new IgniteConfiguration(TestUtils.GetTestConfiguration()) {PluginConfigurations = x});
-
- // Missing attribute.
- var ex = Assert.Throws<IgniteException>(() => check(new[] { new NoAttributeConfig(), }));
+ var ex = Assert.Throws<IgniteException>(() => TryStart(new[] { new NoAttributeConfig() }));
Assert.IsNotNull(ex.InnerException);
Assert.AreEqual(string.Format("{0} of type {1} has no {2}", typeof(IPluginConfiguration),
typeof(NoAttributeConfig), typeof(PluginProviderTypeAttribute)), ex.InnerException.Message);
+ }
- // Empty plugin name.
- ex = Assert.Throws<IgniteException>(() => check(new[] {new EmptyNameConfig()}));
+ [Test]
+ public void IgnitionStart_EmptyPluginName_ThrowsException()
+ {
+ var ex = Assert.Throws<IgniteException>(() => TryStart(new[] {new EmptyNameConfig()}));
Assert.IsNotNull(ex.InnerException);
Assert.AreEqual(string.Format("{0}.Name should not be null or empty: {1}", typeof(IPluginProvider<>),
typeof(EmptyNamePluginProvider)), ex.InnerException.Message);
+ }
- // Duplicate plugin name.
- ex = Assert.Throws<IgniteException>(() => check(new[]
+ [Test]
+ public void IgnitionStart_DuplicatePluginName_ThrowsException()
+ {
+ var ex = Assert.Throws<IgniteException>(() => TryStart(new[]
{
new TestIgnitePluginConfiguration(),
new TestIgnitePluginConfiguration()
@@ -205,12 +212,18 @@ namespace Apache.Ignite.Core.Tests.Plugin
Assert.IsNotNull(ex.InnerException);
Assert.AreEqual(string.Format("Duplicate plugin name 'TestPlugin1' is used by plugin providers " +
"'{0}' and '{0}'", typeof(TestIgnitePluginProvider)),
- ex.InnerException.Message);
+ ex.InnerException.Message);
+ }
- // Provider throws an exception.
+ /// <summary>
+ /// Tests invalid plugins.
+ /// </summary>
+ [Test]
+ public void IgnitionStart_PluginProviderThrowsException_StopsAndRethrowsException()
+ {
PluginLog.Clear();
- ex = Assert.Throws<IgniteException>(() => check(new IPluginConfiguration[]
+ var ex = Assert.Throws<IgniteException>(() => TryStart(new IPluginConfiguration[]
{
new NormalConfig(), new ExceptionConfig()
}));
@@ -225,10 +238,23 @@ namespace Apache.Ignite.Core.Tests.Plugin
"normalPlugin.Start", "errPlugin.Start",
"errPlugin.Stop", "normalPlugin.Stop"
}, PluginLog);
+ }
- // Verify ignite start-stop.
- Ignition.Start(TestUtils.GetTestConfiguration());
- Ignition.StopAll(true);
+ private static void TryStart(ICollection<IPluginConfiguration> x)
+ {
+ try
+ {
+ var igniteConfiguration = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ PluginConfigurations = x
+ };
+
+ Ignition.Start(igniteConfiguration);
+ }
+ finally
+ {
+ Ignition.StopAll(true);
+ }
}
private class NoAttributeConfig : IPluginConfiguration