summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBala Konda Reddy M <bala12352@gmail.com>2020-07-27 20:05:35 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-07-28 04:41:22 +0000
commit706376004864c050bb22648cffd24881965e37ed (patch)
tree1140c5f9327474ef6c21e6c9d76b65d807de4133
parent6b8f2f0c23a1d5939bdf32dfa70d4bb7deaf7ba7 (diff)
[Testfix] Fix TypeError for python3
Problem: Test is failing with below traceback when ran with python3 as default. ` Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: a bytes-like object is required, not 'str' ` Solution: Added ''.encode() which will fix the issue when ran using both python2 and python3 Added a check for core file on the client node. Change-Id: I8f800f5fad97c3b7591db79ea51203e5293a1f69 Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
-rw-r--r--tests/functional/disperse/test_ec_truncate_file_with_brick_down.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/functional/disperse/test_ec_truncate_file_with_brick_down.py b/tests/functional/disperse/test_ec_truncate_file_with_brick_down.py
index c4daf0a..c0db191 100644
--- a/tests/functional/disperse/test_ec_truncate_file_with_brick_down.py
+++ b/tests/functional/disperse/test_ec_truncate_file_with_brick_down.py
@@ -109,8 +109,8 @@ class TestEcTruncateFileWithBrickDown(GlusterBaseClass):
# write data to the file
cmd = ('''python -c "import os, sys;fd = os.open('{}', os.O_RDWR) ;'''
- '''os.write(fd, 'This is test after truncate'); os.close(fd)"'''
- .format(file_name))
+ '''os.write(fd, 'This is test after truncate'.encode());'''
+ ''' os.close(fd)"'''.format(file_name))
ret, _, err = g.run(self.mounts[0].client_system, cmd)
self.assertEqual(ret, 0, err)
g.log.info("Data written successfully on to the file")
@@ -119,6 +119,7 @@ class TestEcTruncateFileWithBrickDown(GlusterBaseClass):
ret = monitor_heal_completion(self.mnode, self.volname)
self.assertTrue(ret, "Heal pending for file {}".format(file_name))
- # check for any crashes
- ret = is_core_file_created(self.servers, test_timestamp)
- self.assertTrue(ret, "Cores found on the servers")
+ # check for any crashes on servers and client
+ for nodes in (self.servers, [self.clients[0]]):
+ ret = is_core_file_created(nodes, test_timestamp)
+ self.assertTrue(ret, "Cores found on the {} nodes".format(nodes))