[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH nbdkit] tests: Adjust test-fua.sh for correct use .prepare in log filter.



Commit b5ce88e889a2df4baa0b73033f7302e5b40f0570 fixed the cases where
multiple filters are placed in front of a plugin, so that now .prepare
and .finalize methods are called properly in the second and subsequent
filters.

This causes an additional log message to be emitted (correctly) from
the newly called .prepare method in the log filter:

  2018-08-01 15:17:45.249533 connection=1 Connect [...]

However this extra log message incidentally breaks the FUA test.

Fix this by filtering out the additional log message before counting
the instances of the fua=1 flag in this test.

Thanks: Eric Blake.
---
 tests/test-fua.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test-fua.sh b/tests/test-fua.sh
index 8a8c7fc..0329807 100755
--- a/tests/test-fua.sh
+++ b/tests/test-fua.sh
@@ -132,14 +132,14 @@ test $(grep -c 'connection=1 Flush' fua1.log) -lt \
 # all earlier parts of the transaction do not have fua
 flush1=$(grep -c 'connection=1 Flush' fua2.log || :)
 flush2=$(grep -c 'connection=2 Flush' fua2.log || :)
-fua=$(grep -c 'connection=2.*fua=1' fua2.log || :)
+fua=$(grep -v "Connect" fua2.log | grep -c 'connection=2.*fua=1' || :)
 test $(( $flush2 - $flush1 + $fua )) = 2
 
 # Test 3: every part of split has fua, and no flushes are added
 flush1=$(grep -c 'connection=1 Flush' fua3.log || :)
 flush2=$(grep -c 'connection=2 Flush' fua3.log || :)
 test $flush1 = $flush2
-test $(grep -c 'connection=2.*fua=1' fua3.log) = 32
+test $(grep -v "Connect" fua3.log | grep -c 'connection=2.*fua=1') = 32
 
 # Test 4: flush is no-op, and every transaction has fua
 if grep 'fua=0' fua4.log; then
-- 
2.18.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]