Beispiel #1
0
 public virtual void TestSkipQuotaCheck()
 {
     try
     {
         // set quota. nsQuota of 1 means no files can be created
         //  under this directory.
         hdfs.SetQuota(sub2, 1, long.MaxValue);
         // create a file
         try
         {
             // this should fail
             DFSTestUtil.CreateFile(hdfs, file6, 1024, Replication, seed);
             throw new IOException("The create should have failed.");
         }
         catch (NSQuotaExceededException)
         {
         }
         // ignored
         // disable the quota check and retry. this should succeed.
         fsdir.DisableQuotaChecks();
         DFSTestUtil.CreateFile(hdfs, file6, 1024, Replication, seed);
         // trying again after re-enabling the check.
         hdfs.Delete(file6, false);
         // cleanup
         fsdir.EnableQuotaChecks();
         try
         {
             // this should fail
             DFSTestUtil.CreateFile(hdfs, file6, 1024, Replication, seed);
             throw new IOException("The create should have failed.");
         }
         catch (NSQuotaExceededException)
         {
         }
     }
     finally
     {
         // ignored
         hdfs.Delete(file6, false);
         // cleanup, in case the test failed in the middle.
         hdfs.SetQuota(sub2, long.MaxValue, long.MaxValue);
     }
 }