From 72873abe058997dc3fe5fadaf002feb47fbbff68 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Thu, 9 Feb 2017 14:17:52 +0100 Subject: [PATCH] test: file: test the behaviour of inotify on parent dir moves This is a test for #124. It is disabled until #124 is fixed, so it can already me merged. Signed-off-by: Julien Pivotto --- examples/deep-dirs.yaml | 9 +++++++++ test/shell/file-move-upper-dir.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 examples/deep-dirs.yaml create mode 100755 test/shell/file-move-upper-dir.sh diff --git a/examples/deep-dirs.yaml b/examples/deep-dirs.yaml new file mode 100644 index 00000000..f9c967db --- /dev/null +++ b/examples/deep-dirs.yaml @@ -0,0 +1,9 @@ +--- +graph: mygraph +resources: + file: + - name: file1 + path: "/tmp/mgmt/a/b/c/f1" + content: | + i am f1 + state: exists diff --git a/test/shell/file-move-upper-dir.sh b/test/shell/file-move-upper-dir.sh new file mode 100755 index 00000000..3e1db994 --- /dev/null +++ b/test/shell/file-move-upper-dir.sh @@ -0,0 +1,31 @@ +#!/bin/bash -e + +# FIXME: test for #124 --- Disabled for now + +exit 0 + +mkdir -p /tmp/mgmt/a/b/c/ + +# run empty graph, with prometheus support +timeout --kill-after=20s 15s ./mgmt run --tmp-prefix --yaml=examples/deep-dirs.yaml & +pid=$! +sleep 5s # let it converge + +grep f1 /tmp/mgmt/a/b/c/f1 + +echo 'f2!' > /tmp/mgmt/a/b/c/f1 + +grep f1 /tmp/mgmt/a/b/c/f1 + +rm -rf /tmp/mgmt/a/b/C/ || true +mv /tmp/mgmt/a/b/c /tmp/mgmt/a/b/C/ + +mkdir -p /tmp/mgmt/a/b/c + +echo 'f2!' > /tmp/mgmt/a/b/c/f1 + +grep f1 /tmp/mgmt/a/b/c/f1 + +killall -SIGINT mgmt # send ^C to exit mgmt +wait $pid # get exit status +exit $?