[v3,3/3] test: adapt RPC configuration file test

Submitted by Adrian Reber on Dec. 12, 2018, 7:44 a.m.

Details

Message ID 1544600692-12905-3-git-send-email-adrian@lisas.de
State New
Series "Series without cover letter"
Headers show

Commit Message

Adrian Reber Dec. 12, 2018, 7:44 a.m.
From: Adrian Reber <areber@redhat.com>

The RPC configuration file test expects CRIU to error out if an unknown
option is found in the configuration file. As the previous commit of
this series changes unknown options in the configuration file (via RPC)
from an error to a warning, the corresponding test is now also changed
to not expect an error from CRIU but it is now looking for a warning in
the log file.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 test/others/rpc/config_file.py | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/others/rpc/config_file.py b/test/others/rpc/config_file.py
index b74cc04..f21d194 100755
--- a/test/others/rpc/config_file.py
+++ b/test/others/rpc/config_file.py
@@ -7,7 +7,6 @@  import rpc_pb2 as rpc
 import argparse
 import subprocess
 from tempfile import mkstemp
-import time
 
 log_file = 'config_file_test.log'
 does_not_exist = 'does-not.exist'
@@ -68,24 +67,16 @@  def do_rpc(s, req):
 
 def test_broken_configuration_file():
 	# Testing RPC configuration file mode with a broken configuration file.
-	# This should fail
+	# This should not fail but print a warning
 	content = 'hopefully-this-option-will-never=exist'
 	path = setup_config_file(content)
-	swrk, s = setup_swrk()
+	req = setup_criu_dump_request()
+	_, s = setup_swrk()
+	resp = do_rpc(s, req)
 	s.close()
-	# This test is only about detecting wrong configuration files.
-	# If we do not sleep it might happen that we kill CRIU before
-	# it parses the configuration file. A short sleep makes sure
-	# that the configuration file has been parsed. Hopefully.
-	# (I am sure this will fail horribly at some point)
-	time.sleep(0.3)
-	swrk.kill()
-	return_code = swrk.wait()
-	# delete temporary file again
 	cleanup_config_file(path)
-	if return_code != 1:
-		print('FAIL: CRIU should have returned 1 instead of %d' % return_code)
-		sys.exit(-1)
+	check_results(resp, log_file)
+	search_in_log_file(log_file, 'Unknown option encountered')
 
 
 def search_in_log_file(log, message):

Comments

Radostin Stoyanov Dec. 12, 2018, 8:40 a.m.
On 12/12/2018 07:44, Adrian Reber wrote:
> From: Adrian Reber <areber@redhat.com>
>
> The RPC configuration file test expects CRIU to error out if an unknown
> option is found in the configuration file. As the previous commit of
> this series changes unknown options in the configuration file (via RPC)
> from an error to a warning, the corresponding test is now also changed
> to not expect an error from CRIU but it is now looking for a warning in
> the log file.
>
> Signed-off-by: Adrian Reber <areber@redhat.com>
> ---
>  test/others/rpc/config_file.py | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)
>
Acked-by: Radostin Stoyanov <rstoyanov1@gmail.com>