Repository: reef Updated Branches: refs/heads/master 48bde0c0e -> 0480d0ebd
[REEF-1312] Convert IMRU.Examples to test This change creates tests which call IMRU.Examples and verify the run succeeded. At the moment only local runtime tests are operational, as none of our functional tests can run on Yarn yet. JIRA: [REEF-1312](https://issues.apache.org/jira/browse/REEF-1312) Pull request: This closes #940 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/0480d0eb Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/0480d0eb Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/0480d0eb Branch: refs/heads/master Commit: 0480d0ebdea5971d8664be553738cb646648e6e8 Parents: 48bde0c Author: Mariia Mykhailova <[email protected]> Authored: Fri Apr 8 16:00:52 2016 -0700 Committer: Markus Weimer <[email protected]> Committed: Wed Apr 13 11:52:17 2016 -0700 ---------------------------------------------------------------------- lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs | 8 +-- .../Functional/IMRU/IMRUBroadcastReduceTest.cs | 58 ++++++++++++++++++++ .../Functional/IMRU/IMRUMapperCountTest.cs | 58 ++++++++++++++++++++ .../Org.Apache.REEF.Tests.csproj | 6 ++ 4 files changed, 126 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/0480d0eb/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs b/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs index f58cab6..18876ab 100644 --- a/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs +++ b/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs @@ -36,7 +36,7 @@ namespace Org.Apache.REEF.IMRU.Examples { private static readonly Logger Logger = Logger.GetLogger(typeof(Run)); - private static void RunMapperTest(IConfiguration tcpPortConfig, bool runOnYarn, int numNodes, string filename) + public static void RunMapperTest(IConfiguration tcpPortConfig, bool runOnYarn, int numNodes, string filename, params string[] runtimeDir) { IInjector injector; IConfiguration fileSystemConfig; @@ -45,7 +45,7 @@ namespace Org.Apache.REEF.IMRU.Examples { injector = TangFactory.GetTang() - .NewInjector(OnREEFIMRURunTimeConfiguration<int, int, int>.GetLocalIMRUConfiguration(numNodes), tcpPortConfig); + .NewInjector(OnREEFIMRURunTimeConfiguration<int, int, int>.GetLocalIMRUConfiguration(numNodes, runtimeDir), tcpPortConfig); fileSystemConfig = LocalFileSystemConfiguration.ConfigurationModule.Build(); } else @@ -59,7 +59,7 @@ namespace Org.Apache.REEF.IMRU.Examples mapperCountExample.Run(numNodes - 1, filename, fileSystemConfig); } - private static void RunBroadcastReduceTest(IConfiguration tcpPortConfig, bool runOnYarn, int numNodes, string[] args) + public static void RunBroadcastReduceTest(IConfiguration tcpPortConfig, bool runOnYarn, int numNodes, string[] args, params string[] runtimeDir) { int chunkSize = 2; int dims = 10; @@ -98,7 +98,7 @@ namespace Org.Apache.REEF.IMRU.Examples { injector = TangFactory.GetTang() - .NewInjector(OnREEFIMRURunTimeConfiguration<int[], int[], int[]>.GetLocalIMRUConfiguration(numNodes), tcpPortConfig); + .NewInjector(OnREEFIMRURunTimeConfiguration<int[], int[], int[]>.GetLocalIMRUConfiguration(numNodes, runtimeDir), tcpPortConfig); } else { http://git-wip-us.apache.org/repos/asf/reef/blob/0480d0eb/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUBroadcastReduceTest.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUBroadcastReduceTest.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUBroadcastReduceTest.cs new file mode 100644 index 0000000..cb012dc --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUBroadcastReduceTest.cs @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using Org.Apache.REEF.Utilities.Logging; +using Xunit; +using Org.Apache.REEF.Client.API; +using Org.Apache.REEF.IMRU.Examples; + +namespace Org.Apache.REEF.Tests.Functional.IMRU +{ + [Collection("FunctionalTests")] + public class IMRUBroadcastReduceTest : ReefFunctionalTest + { + private static readonly Logger Logger = Logger.GetLogger(typeof(IMRUMapperCountTest)); + + private static readonly int numNodes = 4; + + [Fact] + [Trait("Description", "Run IMRU broadcast and reduce example as test.")] + void TestIMRUBroadcastReduceOnLocalRuntime() + { + string testFolder = DefaultRuntimeFolder + TestId; + TestIMRUBroadcastReduce(false, testFolder); + ValidateSuccessForLocalRuntime(numNodes, testFolder: testFolder); + CleanUp(testFolder); + } + + [Fact(Skip = "Requires Yarn")] + [Trait("Description", "Run IMRU broadcast and reduce example as test on Yarn.")] + void TestIMRUBroadcastReduceOnYarn() + { + TestIMRUBroadcastReduce(true); + } + + private void TestIMRUBroadcastReduce(bool runOnYarn, params string[] testFolder) + { + var tcpPortConfig = TcpPortConfigurationModule.ConfigurationModule + .Set(TcpPortConfigurationModule.PortRangeStart, "8900") + .Set(TcpPortConfigurationModule.PortRangeCount, "1000") + .Build(); + Run.RunBroadcastReduceTest(tcpPortConfig, runOnYarn, numNodes, new string[0], testFolder); + } + } +} http://git-wip-us.apache.org/repos/asf/reef/blob/0480d0eb/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUMapperCountTest.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUMapperCountTest.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUMapperCountTest.cs new file mode 100644 index 0000000..a88e9e7 --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/IMRUMapperCountTest.cs @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using Org.Apache.REEF.Utilities.Logging; +using Xunit; +using Org.Apache.REEF.Client.API; +using Org.Apache.REEF.IMRU.Examples; + +namespace Org.Apache.REEF.Tests.Functional.IMRU +{ + [Collection("FunctionalTests")] + public class IMRUMapperCountTest : ReefFunctionalTest + { + private static readonly Logger Logger = Logger.GetLogger(typeof(IMRUMapperCountTest)); + + private static readonly int numNodes = 4; + + [Fact] + [Trait("Description", "Run IMRU mapper count example as test.")] + void TestIMRUMapperCountOnLocalRuntime() + { + string testFolder = DefaultRuntimeFolder + TestId; + TestIMRUMapperCount(false, testFolder); + ValidateSuccessForLocalRuntime(numNodes, testFolder: testFolder); + CleanUp(testFolder); + } + + [Fact(Skip = "Requires Yarn")] + [Trait("Description", "Run IMRU mapper count example as test on Yarn.")] + void TestIMRUMapperCountOnYarn() + { + TestIMRUMapperCount(true); + } + + private void TestIMRUMapperCount(bool runOnYarn, params string[] testFolder) + { + var tcpPortConfig = TcpPortConfigurationModule.ConfigurationModule + .Set(TcpPortConfigurationModule.PortRangeStart, "8900") + .Set(TcpPortConfigurationModule.PortRangeCount, "1000") + .Build(); + Run.RunMapperTest(tcpPortConfig, runOnYarn, numNodes, " ", testFolder); + } + } +} http://git-wip-us.apache.org/repos/asf/reef/blob/0480d0eb/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj index 0ee261f..5d501a8 100644 --- a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj +++ b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj @@ -85,6 +85,8 @@ under the License. <Compile Include="Functional\Driver\DriverTestStartHandler.cs" /> <Compile Include="Functional\FaultTolerant\TestContextStart.cs" /> <Compile Include="Functional\FaultTolerant\TestResubmitEvaluator.cs" /> + <Compile Include="Functional\IMRU\IMRUBroadcastReduceTest.cs" /> + <Compile Include="Functional\IMRU\IMRUMapperCountTest.cs" /> <Compile Include="Functional\RuntimeName\EvaluatorRequestingDriverSpecifyingDefaultRuntimeName.cs" /> <Compile Include="Functional\RuntimeName\EvaluatorRequestingDriverSpecifyingInvalidRuntimeName.cs" /> <Compile Include="Functional\RuntimeName\EvaluatorRequestingDriverSpecifyingRuntimeName.cs" /> @@ -160,6 +162,10 @@ under the License. <Project>{159f7d70-8acc-4d97-9f6d-2fc4ca0d8682}</Project> <Name>Org.Apache.REEF.Examples.AllHandlers</Name> </ProjectReference> + <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.IMRU.Examples\Org.Apache.REEF.IMRU.Examples.csproj"> + <Project>{6dc3b04e-2b99-4fda-bd23-2c7864f4c477}</Project> + <Name>Org.Apache.REEF.IMRU.Examples</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
