Blame SOURCES/kvm-iotests-Make-233-output-more-reliable.patch

383d26
From 0269fa2be355b2885e90bd676f63ae5fe4e8de08 Mon Sep 17 00:00:00 2001
383d26
From: John Snow <jsnow@redhat.com>
383d26
Date: Wed, 27 Mar 2019 17:22:35 +0100
383d26
Subject: [PATCH 097/163] iotests: Make 233 output more reliable
383d26
MIME-Version: 1.0
383d26
Content-Type: text/plain; charset=UTF-8
383d26
Content-Transfer-Encoding: 8bit
383d26
383d26
RH-Author: John Snow <jsnow@redhat.com>
383d26
Message-id: <20190327172308.31077-23-jsnow@redhat.com>
383d26
Patchwork-id: 85189
383d26
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 22/55] iotests: Make 233 output more reliable
383d26
Bugzilla: 1691009
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: Max Reitz <mreitz@redhat.com>
383d26
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
383d26
From: Eric Blake <eblake@redhat.com>
383d26
383d26
We have a race between the nbd server and the client both trying
383d26
to report errors at once which can make the test sometimes fail
383d26
if the output lines swap order under load.  Break the race by
383d26
collecting server messages into a file and then replaying that
383d26
at the end of the test.
383d26
383d26
We may yet want to fix the server to not output ANYTHING for a
383d26
client action except when -v was used (to avoid malicious clients
383d26
from being able to DoS a server by filling up its logs), but that
383d26
is saved for a future patch.
383d26
383d26
Signed-off-by: Eric Blake <eblake@redhat.com>
383d26
CC: Daniel P. Berrangé <berrange@redhat.com>
383d26
Message-Id: <20190117193658.16413-2-eblake@redhat.com>
383d26
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
383d26
(cherry picked from commit d08980511d78480ffbbd9897b7fd050bd03d518d)
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 tests/qemu-iotests/233     | 11 ++++++++---
383d26
 tests/qemu-iotests/233.out |  4 +++-
383d26
 2 files changed, 11 insertions(+), 4 deletions(-)
383d26
383d26
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
383d26
index 1814efe..ab15c77 100755
383d26
--- a/tests/qemu-iotests/233
383d26
+++ b/tests/qemu-iotests/233
383d26
@@ -2,7 +2,7 @@
383d26
 #
383d26
 # Test NBD TLS certificate / authorization integration
383d26
 #
383d26
-# Copyright (C) 2018 Red Hat, Inc.
383d26
+# Copyright (C) 2018-2019 Red Hat, Inc.
383d26
 #
383d26
 # This program is free software; you can redistribute it and/or modify
383d26
 # it under the terms of the GNU General Public License as published by
383d26
@@ -30,6 +30,7 @@ _cleanup()
383d26
 {
383d26
     nbd_server_stop
383d26
     _cleanup_test_img
383d26
+    rm -f "$TEST_DIR/server.log"
383d26
     tls_x509_cleanup
383d26
 }
383d26
 trap "_cleanup; exit \$status" 0 1 2 3 15
383d26
@@ -66,7 +67,7 @@ $QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io
383d26
 
383d26
 echo
383d26
 echo "== check TLS client to plain server fails =="
383d26
-nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG"
383d26
+nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG" 2> "$TEST_DIR/server.log"
383d26
 
383d26
 $QEMU_IMG info --image-opts \
383d26
     --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
383d26
@@ -81,7 +82,7 @@ echo "== check plain client to TLS server fails =="
383d26
 nbd_server_start_tcp_socket \
383d26
     --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes \
383d26
     --tls-creds tls0 \
383d26
-    -f $IMGFMT "$TEST_IMG"
383d26
+    -f $IMGFMT "$TEST_IMG" 2>> "$TEST_DIR/server.log"
383d26
 
383d26
 $QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
383d26
 
383d26
@@ -109,6 +110,10 @@ $QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \
383d26
 
383d26
 $QEMU_IO -f $IMGFMT -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
383d26
 
383d26
+echo
383d26
+echo "== final server log =="
383d26
+cat "$TEST_DIR/server.log"
383d26
+
383d26
 # success, all done
383d26
 echo "*** done"
383d26
 rm -f $seq.full
383d26
diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out
383d26
index 5f41672..2199d8a 100644
383d26
--- a/tests/qemu-iotests/233.out
383d26
+++ b/tests/qemu-iotests/233.out
383d26
@@ -27,7 +27,6 @@ virtual size: 64M (67108864 bytes)
383d26
 disk size: unavailable
383d26
 
383d26
 == check TLS with different CA fails ==
383d26
-qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
383d26
 qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': The certificate hasn't got a known issuer
383d26
 
383d26
 == perform I/O over TLS ==
383d26
@@ -37,4 +36,7 @@ wrote 1048576/1048576 bytes at offset 1048576
383d26
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
383d26
 read 1048576/1048576 bytes at offset 1048576
383d26
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
383d26
+
383d26
+== final server log ==
383d26
+qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
383d26
 *** done
383d26
-- 
383d26
1.8.3.1
383d26