github.com/vmware/govmomi@v0.43.0/govc/test/datastore_tail_test.sh (about) 1 #!/bin/bash -xe 2 3 # This test is not run via bats as the bats pipeline hangs when we background a process 4 5 . "$(dirname "$0")"/test_helper.bash 6 7 name=$(new_id) 8 n=16 9 tmp=$(mktemp --tmpdir "${name}-XXXXX") 10 11 echo -n | govc datastore.upload - "$name" 12 govc datastore.tail -f "$name" > "$tmp" & 13 pid=$! 14 15 sleep 1 16 yes | dd bs=${n}K count=1 2>/dev/null | govc datastore.upload - "$name" 17 sleep 2 18 19 # stops following when the file has gone away 20 govc datastore.mv "$name" "${name}.old" 21 wait $pid 22 23 govc datastore.download "${name}.old" - | cmp "$tmp" - 24 25 rm "$tmp" 26 teardown