Skip to content

Commit

Permalink
to be merged: test error message if key not available
Browse files Browse the repository at this point in the history
  • Loading branch information
urykhy committed Feb 26, 2022
1 parent f722307 commit 1328f22
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/hdfs/test/helper.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

export HADOOP_FS=${HADOOP_FS-"hadoop fs"}
export HADOOP_KEY=${HADOOP_KEY-"hadoop key"}
export ROOT_TEST_DIR="$BATS_TEST_DIRNAME/../../.."
export HDFS="$ROOT_TEST_DIR/hdfs"

Expand Down
19 changes: 19 additions & 0 deletions cmd/hdfs/test/te.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,22 @@ load helper
skip
fi
}

@test "te: download file if key not available" {
if [ "$TRANSPARENT_ENCRYPTION" = "true" ]; then
run $HADOOP_FS -mkdir -p /_test/kms-no-key
assert_success
run $HADOOP_KEY create key-removed
assert_success
run hdfs crypto -createZone -keyName key-removed -path /_test/kms-no-key
assert_success
run $HADOOP_FS -put $ROOT_TEST_DIR/testdata/foo.txt /_test/kms-no-key/foo
assert_success
run $HADOOP_KEY delete key-removed -f
assert_success
run $HDFS cat /_test/kms-no-key/foo
assert_output "open /_test/kms-no-key/foo: kms: unexpected response code from KMS: 400: 'key-removed@0' not found"
else
skip
fi
}

0 comments on commit 1328f22

Please sign in to comment.