Пример #1
0
 public virtual void TestSetXAttrSnapshotPath()
 {
     FileSystem.Mkdirs(hdfs, path, FsPermission.CreateImmutable((short)0x1c0));
     SnapshotTestHelper.CreateSnapshot(hdfs, path, snapshotName);
     exception.Expect(typeof(SnapshotAccessControlException));
     hdfs.SetXAttr(snapshotPath, name1, value1);
 }
Пример #2
0
 public virtual void TestVerifyChunkedSumsFail()
 {
     AllocateDirectByteBuffers();
     FillDataAndInvalidChecksums();
     exception.Expect(typeof(ChecksumException));
     NativeCrc32.VerifyChunkedSums(bytesPerChecksum, checksumType.id, checksums, data,
                                   fileName, BasePosition);
 }
Пример #3
0
        public virtual void TestClientAndServerDoNotHaveCommonQop()
        {
            HdfsConfiguration clusterConf = CreateSecureConfig("privacy");

            StartCluster(clusterConf);
            HdfsConfiguration clientConf = new HdfsConfiguration(clusterConf);

            clientConf.Set(DFSConfigKeys.DfsDataTransferProtectionKey, "authentication");
            exception.Expect(typeof(IOException));
            exception.ExpectMessage("could only be replicated to 0 nodes");
            DoTest(clientConf);
        }
Пример #4
0
        /// <summary>Test rename a non-existing snapshot</summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestRenameNonExistingSnapshot()
        {
            DFSTestUtil.CreateFile(hdfs, file1, Blocksize, Replication, seed);
            // Create snapshot for sub1
            SnapshotTestHelper.CreateSnapshot(hdfs, sub1, "s1");
            exception.Expect(typeof(SnapshotException));
            string error = "The snapshot wrongName does not exist for directory " + sub1.ToString
                               ();

            exception.ExpectMessage(error);
            hdfs.RenameSnapshot(sub1, "wrongName", "s2");
        }
Пример #5
0
        public virtual void TestDoPreUpgradeIOError()
        {
            FilePath    storageDir = new FilePath(TestEditLog.TestDir, "preupgradeioerror");
            IList <URI> editUris   = Sharpen.Collections.SingletonList(storageDir.ToURI());
            NNStorage   storage    = TestEditLog.SetupEdits(editUris, 5);

            Storage.StorageDirectory sd = storage.DirIterator(NNStorage.NameNodeDirType.Edits
                                                              ).Next();
            NUnit.Framework.Assert.IsNotNull(sd);
            // Change storage directory so that renaming current to previous.tmp fails.
            FileUtil.SetWritable(storageDir, false);
            FileJournalManager jm = null;

            try
            {
                jm = new FileJournalManager(conf, sd, storage);
                exception.Expect(typeof(IOException));
                if (NativeCodeLoader.IsNativeCodeLoaded())
                {
                    exception.ExpectMessage("failure in native rename");
                }
                jm.DoPreUpgrade();
            }
            finally
            {
                IOUtils.Cleanup(Log, jm);
                // Restore permissions on storage directory and make sure we can delete.
                FileUtil.SetWritable(storageDir, true);
                FileUtil.FullyDelete(storageDir);
            }
        }
Пример #6
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public virtual void DoShortCircuitReadBlockFileCorruptionTest()
        {
            string MethodName = GenericTestUtils.GetMethodName();
            Path   path1      = new Path("/" + MethodName + ".01.dat");
            Path   path2      = new Path("/" + MethodName + ".02.dat");
            int    Seed       = unchecked ((int)(0xFADED));

            MakeRandomTestFile(path1, BlockSize, true, Seed);
            EnsureFileReplicasOnStorageType(path1, StorageType.RamDisk);
            // Create another file with a replica on RAM_DISK, which evicts the first.
            MakeRandomTestFile(path2, BlockSize, true, Seed);
            // Sleep for a short time to allow the lazy writer thread to do its job.
            Sharpen.Thread.Sleep(3 * LazyWriterIntervalSec * 1000);
            TriggerBlockReport();
            // Corrupt the lazy-persisted block file, and verify that checksum
            // verification catches it.
            EnsureFileReplicasOnStorageType(path1, StorageType.Default);
            cluster.CorruptReplica(0, DFSTestUtil.GetFirstBlock(fs, path1));
            exception.Expect(typeof(ChecksumException));
            DFSTestUtil.ReadFileBuffer(fs, path1);
        }
Пример #7
0
 /// <summary>
 /// We expect an AclException, and we want the exception text to state the
 /// configuration key that controls ACL support.
 /// </summary>
 private void ExpectException()
 {
     exception.Expect(typeof(AclException));
     exception.ExpectMessage(DFSConfigKeys.DfsNamenodeAclsEnabledKey);
 }