File: checksum.bats

package info (click to toggle)
golang-github-colinmarc-hdfs 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,760 kB
  • sloc: sh: 130; xml: 40; makefile: 31
file content (29 lines) | stat: -rw-r--r-- 557 bytes parent folder | download
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
}