1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/usr/bin/env bats
load helper
setup() {
$HDFS mkdir -p /_test_cmd/checksum/dir
}
@test "checksum" {
FOO_CHECKSUM=$($HADOOP_FS -checksum hdfs://$HADOOP_NAMENODE/_test/foo.txt | tail -1 | awk '{ print substr($3, 25, 32) }')
run $HDFS checksum /_test/foo.txt
assert_success
assert_output <<OUT
$FOO_CHECKSUM /_test/foo.txt
OUT
}
@test "checksum nonexistent" {
run $HDFS cat /_test_cmd/nonexistent
assert_failure
assert_output <<OUT
open /_test_cmd/nonexistent: file does not exist
OUT
}
teardown() {
$HDFS rm -r /_test_cmd/checksum
}
|