/// <exception cref="System.Exception"/>
        private void RunTest(int nNameNodes, int nDataNodes, Configuration conf)
        {
            Log.Info("nNameNodes=" + nNameNodes + ", nDataNodes=" + nDataNodes);
            Log.Info("RUN_TEST -1");
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NnTopology(MiniDFSNNTopology
                                                                                 .SimpleFederatedTopology(nNameNodes)).NumDataNodes(nDataNodes).Build();

            Log.Info("RUN_TEST 0");
            DFSTestUtil.SetFederatedConfiguration(cluster, conf);
            try
            {
                cluster.WaitActive();
                Log.Info("RUN_TEST 1");
                TestFsckWithMultipleNameNodes.Suite s = new TestFsckWithMultipleNameNodes.Suite(cluster
                                                                                                , nNameNodes, nDataNodes);
                for (int i = 0; i < nNameNodes; i++)
                {
                    s.CreateFile(i, 1024);
                }
                Log.Info("RUN_TEST 2");
                string[] urls = new string[nNameNodes];
                for (int i_1 = 0; i_1 < urls.Length; i_1++)
                {
                    urls[i_1] = cluster.GetFileSystem(i_1).GetUri() + FileName;
                    Log.Info("urls[" + i_1 + "]=" + urls[i_1]);
                    string result = TestFsck.RunFsck(conf, 0, false, urls[i_1]);
                    Log.Info("result=" + result);
                    NUnit.Framework.Assert.IsTrue(result.Contains("Status: HEALTHY"));
                }
                // Test viewfs
                //
                Log.Info("RUN_TEST 3");
                string[] vurls = new string[nNameNodes];
                for (int i_2 = 0; i_2 < vurls.Length; i_2++)
                {
                    string link = "/mount/nn_" + i_2 + FileName;
                    ConfigUtil.AddLink(conf, link, new URI(urls[i_2]));
                    vurls[i_2] = "viewfs:" + link;
                }
                for (int i_3 = 0; i_3 < vurls.Length; i_3++)
                {
                    Log.Info("vurls[" + i_3 + "]=" + vurls[i_3]);
                    string result = TestFsck.RunFsck(conf, 0, false, vurls[i_3]);
                    Log.Info("result=" + result);
                    NUnit.Framework.Assert.IsTrue(result.Contains("Status: HEALTHY"));
                }
            }
            finally
            {
                cluster.Shutdown();
            }
            Log.Info("RUN_TEST 6");
        }
Esempio n. 2
0
        /// <exception cref="System.Exception"/>
        private void TestSleepJobInternal(bool useRemoteJar)
        {
            Log.Info("\n\n\nStarting testSleepJob: useRemoteJar=" + useRemoteJar);
            if (!(new FilePath(MiniMRYarnCluster.Appjar)).Exists())
            {
                Log.Info("MRAppJar " + MiniMRYarnCluster.Appjar + " not found. Not running test."
                         );
                return;
            }
            Configuration sleepConf = new Configuration(mrCluster.GetConfig());

            // set master address to local to test that local mode applied iff framework == local
            sleepConf.Set(MRConfig.MasterAddress, "local");
            SleepJob sleepJob = new SleepJob();

            sleepJob.SetConf(sleepConf);
            // job with 3 maps (10s) and numReduces reduces (5s), 1 "record" each:
            Job job = sleepJob.CreateJob(3, numSleepReducers, 10000, 1, 5000, 1);

            job.AddFileToClassPath(AppJar);
            // The AppMaster jar itself.
            if (useRemoteJar)
            {
                Path localJar = new Path(ClassUtil.FindContainingJar(typeof(SleepJob)));
                ConfigUtil.AddLink(job.GetConfiguration(), "/jobjars", localFs.MakeQualified(localJar
                                                                                             .GetParent()).ToUri());
                job.SetJar("viewfs:///jobjars/" + localJar.GetName());
            }
            else
            {
                job.SetJarByClass(typeof(SleepJob));
            }
            job.SetMaxMapAttempts(1);
            // speed up failures
            job.Submit();
            string trackingUrl = job.GetTrackingURL();
            string jobId       = job.GetJobID().ToString();
            bool   succeeded   = job.WaitForCompletion(true);

            NUnit.Framework.Assert.IsTrue(succeeded);
            NUnit.Framework.Assert.AreEqual(JobStatus.State.Succeeded, job.GetJobState());
            NUnit.Framework.Assert.IsTrue("Tracking URL was " + trackingUrl + " but didn't Match Job ID "
                                          + jobId, trackingUrl.EndsWith(Sharpen.Runtime.Substring(jobId, jobId.LastIndexOf
                                                                                                      ("_")) + "/"));
            VerifySleepJobCounters(job);
            VerifyTaskProgress(job);
        }