This commit is contained in:
Colin Marc 2014-10-31 21:38:12 +01:00
Родитель 5baa02d9fe
Коммит 3b3141ba95
2 изменённых файлов: 27 добавлений и 1 удалений

25
cmd/hdfs/test/cat.bats Normal file
Просмотреть файл

@ -0,0 +1,25 @@
#!/usr/bin/env bats
load helper
@test "cat" {
run $HDFS cat /_test/foo.txt
assert_success
assert_output "bar"
}
@test "cat long" {
run bash -c "$HDFS cat /_test/mobydick.txt > $BATS_TMPDIR/mobydick.txt"
assert_success
SHA=`shasum < mobydick.txt | awk '{ print $1 }'`
assert_equal $SHA `shasum < $BATS_TMPDIR/mobydick.txt | awk '{ print $1 }'`
}
@test "cat nonexistent" {
run $HDFS cat /_test_cmd/nonexistent
assert_failure
assert_output <<OUT
open /_test_cmd/nonexistent: file does not exist
OUT
}

Просмотреть файл

@ -1,7 +1,8 @@
#!/bin/bash
export HADOOP_FS="$HADOOP_HOME/bin/hadoop fs -Ddfs.block.size=1048576"
export HDFS="$BATS_TEST_DIRNAME/../../../hdfs"
export ROOT_TEST_DIR="$BATS_TEST_DIRNAME/../../.."
export HDFS="$ROOT_TEST_DIR/hdfs"
# stolen from https://github.com/sstephenson/rbenv/blob/master/test/test_helper.bash