File: datastore_tail_test.sh

package info (click to toggle)
golang-github-vmware-govmomi 0.24.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,848 kB
  • sloc: sh: 2,285; lisp: 1,560; ruby: 948; xml: 139; makefile: 54
file content (26 lines) | stat: -rwxr-xr-x 557 bytes parent folder | download | duplicates (4)
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
#!/bin/bash -xe

# This test is not run via bats as the bats pipeline hangs when we background a process

. "$(dirname "$0")"/test_helper.bash

name=$(new_id)
n=16
tmp=$(mktemp --tmpdir "${name}-XXXXX")

echo -n | govc datastore.upload - "$name"
govc datastore.tail -f "$name" > "$tmp" &
pid=$!

sleep 1
yes | dd bs=${n}K count=1 2>/dev/null | govc datastore.upload - "$name"
sleep 2

# stops following when the file has gone away
govc datastore.mv "$name" "${name}.old"
wait $pid

govc datastore.download "${name}.old" - | cmp "$tmp" -

rm "$tmp"
teardown