test Test basic usage SubstringComparator Usage: bin/hdfs crypto [COMMAND] Test help usage -help SubstringComparator [-createZone -keyName Test extra help argument -help arg1 arg2 SubstringComparator You must give exactly one argument to -help. 1 Test create ez, dir doesn't exist -fs NAMENODE -ls /test- -createZone -path /test -keyName myKey SubstringComparator cannot find /test Test failure of creating EZ on an existing EZ -fs NAMENODE -mkdir /foo -fs NAMENODE -ls /- -createZone -path /foo -keyName myKey -fs NAMENODE -rmdir /foo/.Trash -createZone -path /foo -keyName myKey -fs NAMENODE -rmdir /foo SubstringComparator Directory /foo is already an encryption zone Test success of creating an EZ as a subdir of an existing EZ. -fs NAMENODE -mkdir /foo -fs NAMENODE -ls /- -createZone -keyName myKey -path /foo -fs NAMENODE -mkdir /foo/bar -createZone -keyName myKey -path /foo/bar -fs NAMENODE -rmdir /foo/bar/.Trash -fs NAMENODE -rmdir /foo/bar -fs NAMENODE -rmdir /foo/.Trash -fs NAMENODE -rmdir /foo SubstringComparator Added encryption zone /foo/bar Test failure of creating an EZ using a non-empty directory. -fs NAMENODE -mkdir /foo -fs NAMENODE -touchz /foo/bar -fs NAMENODE -ls /- -createZone -keyName myKey -path /foo -fs NAMENODE -rm /foo/bar -fs NAMENODE -rmdir /foo SubstringComparator Attempt to create an encryption zone for a non-empty directory. Test failure of creating an EZ passing a key that doesn't exist. -fs NAMENODE -mkdir /foo -fs NAMENODE -ls /- -createZone -path /foo -keyName doesntexist -fs NAMENODE -rmdir /foo SubstringComparator Key doesntexist doesn't exist. Test failure of creating an EZ no path is specified. -createZone -keyName blahKey SubstringComparator You must specify a path Test failure of creating an EZ no key is specified. -createZone -path /foo SubstringComparator You must specify a key name Test success of creating an encryption zone a few levels down. -fs NAMENODE -mkdir /foo -fs NAMENODE -mkdir /foo/bar -fs NAMENODE -mkdir /foo/bar/baz -fs NAMENODE -ls /- -createZone -path /foo/bar/baz -keyName myKey -fs NAMENODE -rmdir /foo/bar/baz/.Trash -fs NAMENODE -rmdir /foo/bar/baz -fs NAMENODE -rmdir /foo/bar -fs NAMENODE -rmdir /foo/ SubstringComparator Added encryption zone /foo/bar/baz Test failure of renaming file cross EZ's -fs NAMENODE -mkdir /src -fs NAMENODE -mkdir /dst -fs NAMENODE -ls /- -createZone -path /src -keyName myKey -createZone -path /dst -keyName myKey -fs NAMENODE -mkdir /src/subdir -fs NAMENODE -mv /src/subdir /dst- -fs NAMENODE -rmdir /src/subdir -fs NAMENODE -rmdir /src/.Trash -fs NAMENODE -rmdir /src -fs NAMENODE -rmdir /dst/.Trash -fs NAMENODE -rmdir /dst SubstringComparator /src/subdir can't be moved from encryption zone /src to encryption zone /dst. Test failure of renaming a non-EZ file into an EZ -fs NAMENODE -mkdir /src -fs NAMENODE -mkdir /dst -fs NAMENODE -ls /- -createZone -path /dst -keyName myKey -fs NAMENODE -mv /src /dst- -fs NAMENODE -rmdir /src -fs NAMENODE -rmdir /dst/.Trash -fs NAMENODE -rmdir /dst SubstringComparator /src can't be moved into an encryption zone Test failure of renaming an EZ file into a non-EZ -fs NAMENODE -mkdir /src -fs NAMENODE -mkdir /dst -fs NAMENODE -ls /- -createZone -path /src -keyName myKey -fs NAMENODE -touchz /src/foo -fs NAMENODE -mv /src/foo /dst- -fs NAMENODE -rm /src/foo -fs NAMENODE -rmdir /src/.Trash -fs NAMENODE -rmdir /src -fs NAMENODE -rmdir /dst SubstringComparator /src/foo can't be moved from an encryption zone. Test success of renaming an EZ root -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -fs NAMENODE -mv /src /dst- -fs NAMENODE -ls /- -fs NAMENODE -rmdir /src/.Trash -fs NAMENODE -rm -r /src -fs NAMENODE -rm -r /dst SubstringComparator /dst Test success of renaming file intra-EZ -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -fs NAMENODE -mkdir /src/subdir1 -fs NAMENODE -mkdir /src/subdir2 -fs NAMENODE -mv /src/subdir1 /src/subdir2- -fs NAMENODE -rmdir /src/subdir2/subdir1 -fs NAMENODE -rmdir /src/subdir2 -fs NAMENODE -rmdir /src/.Trash -fs NAMENODE -rmdir /src SubstringComparator Test failure of provisioning a trash dir if the EZ does not exist -fs NAMENODE -mkdir /src -provisionTrash -path /src- -fs NAMENODE -rmdir /src SubstringComparator /src is not an encryption zone. Test failure of provisioning a trash dir if .Trash exists -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -provisionTrash -path /src- -fs NAMENODE -rm /src/.Trash -fs NAMENODE -rmdir /src SubstringComparator Will not provision new trash directory for encryption zone /src. Path already exists. Test success of provisioning a trash dir -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -fs NAMENODE -rmdir /src/.Trash -provisionTrash -path /src- -fs NAMENODE -rmdir /src/.Trash -fs NAMENODE -rmdir /src SubstringComparator Created a trash directory for /src Test failure of provisioning a trash dir for incorrect EZ directory -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -fs NAMENODE -mkdir /src/dir1 -provisionTrash -path /src/dir1- -fs NAMENODE -rmdir /src/dir1 -fs NAMENODE -rmdir /src/.Trash -fs NAMENODE -rmdir /src SubstringComparator /src/dir1 is not the root of an encryption zone. Test success of getFileEncryptionInfo on a EZ file -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -fs NAMENODE -touchz /src/file -getFileEncryptionInfo -path /src/file -fs NAMENODE -rm -r /src SubstringComparator keyName: myKey, ezKeyVersionName: myKey@0 Test failure of getFileEncryptionInfo on a non-EZ file -fs NAMENODE -mkdir /src -fs NAMENODE -touchz /src/cleartext -getFileEncryptionInfo -path /src/cleartext -fs NAMENODE -rm -r /src SubstringComparator No FileEncryptionInfo found for path Test failure of getFileEncryptionInfo on a non-exist file -getFileEncryptionInfo -path /src/file -fs NAMENODE -rm -r /src SubstringComparator FileNotFoundException: Test failure of getFileEncryptionInfo on a EZ dir -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -getFileEncryptionInfo -path /src -fs NAMENODE -rm -r /src SubstringComparator No FileEncryptionInfo found for path Test failure of getFileEncryptionInfo on a EZ subdir -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -fs NAMENODE -mkdir /src/dir -getFileEncryptionInfo -path /src/dir -fs NAMENODE -rm -r /src SubstringComparator No FileEncryptionInfo found for path Test list encryption zones when no zone has been deleted -fs NAMENODE -rm -r .Trash/Current/* -fs NAMENODE -mkdir /test1 -createZone -path /test1 -keyName myKey -listZones -fs NAMENODE -rm -r /test1 -fs NAMENODE -rm -r .Trash/Current/* RegexpAcrossOutputComparator (/test1)\s*(myKey)\s* Test adding two zones, then deleting one and listing zones. The deleted zone should still be listed, as it's under user's Trash folder' -fs NAMENODE -rm -r .Trash/Current/* -fs NAMENODE -mkdir /test1 -fs NAMENODE -mkdir /test2 -createZone -path /test1 -keyName myKey -createZone -path /test2 -keyName myKey -fs NAMENODE -rm -r /test2 -listZones -fs NAMENODE -rm -r /test1 -fs NAMENODE -rm -r .Trash/Current/* RegexpAcrossOutputComparator (/test1)\s*(myKey)\s*(/user/).*(/.Trash/Current/test2)\s*(myKey)\s* Test adding two zones, then permanently deleting one and listing zones. -fs NAMENODE -rm -r .Trash/Current/* -fs NAMENODE -mkdir /test1 -fs NAMENODE -mkdir /test2 -createZone -path /test1 -keyName myKey -createZone -path /test2 -keyName myKey -fs NAMENODE -rm -r /test2 -fs NAMENODE -rm -r .Trash/Current/* -listZones -fs NAMENODE -rm -r /test1 -fs NAMENODE -rm -r .Trash/Current/* RegexpAcrossOutputComparator (/test1)\s*(myKey)\s* Test adding two zones to a snapshotable directory, take snapshot, permanently delete one of the EZs, then list zones -fs NAMENODE -rm -r .Trash/Current/* -fs NAMENODE -mkdir /snapshotable -fs NAMENODE -mkdir /snapshotable/test1 -fs NAMENODE -mkdir /snapshotable/test2 -fs NAMENODE -allowSnapshot /snapshotable -fs NAMENODE -createSnapshot /snapshotable snapshot1 -createZone -path /snapshotable/test1 -keyName myKey -createZone -path /snapshotable/test2 -keyName myKey -fs NAMENODE -rm -r /snapshotable/test2 -fs NAMENODE -rm -r .Trash/Current/* -listZones -fs NAMENODE -deleteSnapshot /snapshotable snapshot1 -fs NAMENODE -rm -r /snapshotable -fs NAMENODE -rm -r .Trash/Current/* RegexpAcrossOutputComparator (/test1)\s*(myKey)\s* Test success of reencrypt submission on a EZ -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -reencryptZone -start -path /src -fs NAMENODE -rm -r -skipTrash /src SubstringComparator successfully submitted for zone: /src action: START Test failure of reencrypt submission on a non-EZ -fs NAMENODE -mkdir /src -reencryptZone -start -path /src -fs NAMENODE -rm -r -skipTrash /src SubstringComparator not the root of an encryption zone Test failure of reencrypt on cancellation a not-being-re-encrypted EZ -fs NAMENODE -mkdir /src -createZone -path /src -keyName myKey -reencryptZone -cancel -path /src -fs NAMENODE -rm -r -skipTrash /src SubstringComparator Zone /src is not under re-encryption Test success of list reencrypt status on a EZ -fs NAMENODE -mkdir /src -fs NAMENODE -mkdir /zone2 -createZone -path /src -keyName myKey -createZone -path /zone2 -keyName myKey -reencryptZone -start -path /src -reencryptZone -start -path /zone2 -listReencryptionStatus -fs NAMENODE -rm -r -skipTrash /src -fs NAMENODE -rm -r -skipTrash /zone2 TokenComparator /src,Completed,false,myKey,zone2 Test adding two zones to a snapshotable directory; The second zone is not a direct child of snapshottable directory; Take snapshot, permanently delete second EZ, then list zones; -fs NAMENODE -rm -r .Trash/Current/* -fs NAMENODE -mkdir /snapshotable -fs NAMENODE -mkdir /snapshotable/test1 -fs NAMENODE -mkdir /snapshotable/test1/test2 -fs NAMENODE -mkdir /snapshotable/test3 -fs NAMENODE -allowSnapshot /snapshotable -createZone -path /snapshotable/test1/test2 -keyName myKey -createZone -path /snapshotable/test3 -keyName myKey -fs NAMENODE -createSnapshot /snapshotable snapshot1 -fs NAMENODE -rm -r /snapshotable/test1 -fs NAMENODE -rm -r .Trash/Current/* -listZones -fs NAMENODE -deleteSnapshot /snapshotable snapshot1 -fs NAMENODE -rm -r /snapshotable -fs NAMENODE -rm -r .Trash/Current/* RegexpAcrossOutputComparator (/test3)\s*(myKey)\s*