You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/04/25 20:16:58 UTC
[libcloud] branch trunk updated: Fix occasional test failure.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
The following commit(s) were added to refs/heads/trunk by this push:
new abbce64 Fix occasional test failure.
new 3ecef3c Merge branch 'trunk' of http://gitbox.apache.org/repos/asf/libcloud into trunk
abbce64 is described below
commit abbce640d974049f6c2a2c701e80c2cf8c680f59
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sat Apr 25 22:15:40 2020 +0200
Fix occasional test failure.
Test failures because we didn't correctly parse query params and test
would fail depending on the dict order which is random (aka if UserData
would be first query parameter).
---
libcloud/test/compute/test_ec2.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 7bcfe5b..e277fba 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1445,9 +1445,15 @@ class EC2MockHttp(MockHttp, unittest.TestCase):
def _ex_user_data_RunInstances(self, method, url, body, headers):
# test_create_node_with_ex_userdata
+ if url.startswith('/'):
+ url = url[1:]
+
+ if url.startswith('?'):
+ url = url[1:]
+
params = parse_qs(url)
- self.assertTrue('UserData' in params)
+ self.assertTrue('UserData' in params, 'UserData not in params, actual params: %s' % (str(params)))
user_data = base64.b64decode(b(params['UserData'][0])).decode('utf-8')
self.assertEqual(user_data, 'foo\nbar\foo')
@@ -2047,6 +2053,7 @@ class OutscaleTests(EC2Tests):
result = self.driver.create_node(name='foo', image=image, size=size,
ex_userdata='foo\nbar\foo')
+ self.assertTrue(result)
class FCUMockHttp(EC2MockHttp):