add tests for cat
This commit is contained in:
Родитель
5baa02d9fe
Коммит
3b3141ba95
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче