示例#1
0
        public virtual void TestDeleteCgroup()
        {
            TestCgroupsLCEResourcesHandler.MockClock clock = new TestCgroupsLCEResourcesHandler.MockClock
                                                                 ();
            clock.time = Runtime.CurrentTimeMillis();
            CgroupsLCEResourcesHandler handler = new CgroupsLCEResourcesHandler();

            handler.SetConf(new YarnConfiguration());
            handler.InitConfig();
            handler.clock = clock;
            FileUtils.DeleteQuietly(cgroupDir);
            // Create a non-empty tasks file
            FilePath         tfile = new FilePath(cgroupDir.GetAbsolutePath(), "tasks");
            FileOutputStream fos   = FileUtils.OpenOutputStream(tfile);

            fos.Write(Sharpen.Runtime.GetBytesForString("1234"));
            fos.Close();
            CountDownLatch latch = new CountDownLatch(1);

            new _Thread_112(latch, clock).Start();
            //NOP
            latch.Await();
            NUnit.Framework.Assert.IsFalse(handler.DeleteCgroup(cgroupDir.GetAbsolutePath()));
            FileUtils.DeleteQuietly(cgroupDir);
        }
示例#2
0
 public _Thread_112(CountDownLatch latch, TestCgroupsLCEResourcesHandler.MockClock
                    clock)
 {
     this.latch = latch;
     this.clock = clock;
 }