← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~smoser/cloud-init/trunk.faster-tests into lp:cloud-init

 

Scott Moser has proposed merging lp:~smoser/cloud-init/trunk.faster-tests into lp:cloud-init.

Commit message:
fix logic error in ec2 get_instance_userdata and slow tests

The change to get_instance_userdata is to fix an issue that
was causing retry in the test when it was not desired.
if user_data returned 404 it means "there was no user-data", so
dont bother retrying.  However, _skip_retry_on_codes was returning
False indicating that readurl should retry.

test_merging was creating 2500 random tests, shrink that down to 100.
test_seed_runs is still on my system the slowest test, but 
taking < .5 seconds where it was taking > 3.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/trunk.faster-tests/+merge/295648
-- 
Your team cloud init development team is requested to review the proposed merge of lp:~smoser/cloud-init/trunk.faster-tests into lp:cloud-init.
=== modified file 'ChangeLog'
--- ChangeLog	2016-04-29 15:23:08 +0000
+++ ChangeLog	2016-05-24 23:43:28 +0000
@@ -109,6 +109,7 @@
    [Wido den Hollander]
  - Paths: fix instance path if datasource's id has a '/'. (LP: #1575938)
    [Robert Jennings]
+ - Ec2: do not retry requests for user-data path on 404.
 
 0.7.6:
  - open 0.7.6

=== modified file 'cloudinit/ec2_utils.py'
--- cloudinit/ec2_utils.py	2015-03-02 20:41:16 +0000
+++ cloudinit/ec2_utils.py	2016-05-24 23:43:28 +0000
@@ -144,9 +144,10 @@
     """Returns if a request should retry based on a given set of codes that
     case retrying to be stopped/skipped.
     """
-    if cause.code in status_codes:
-        return False
-    return True
+    print("status_codes=%s" % status_codes)
+    print("_request_args=%s" % _request_args)
+    print("cause=%s" % cause)
+    return cause.code in status_codes
 
 
 def get_instance_userdata(api_version='latest',

=== modified file 'tests/unittests/test_merging.py'
--- tests/unittests/test_merging.py	2016-05-12 20:43:11 +0000
+++ tests/unittests/test_merging.py	2016-05-24 23:43:28 +0000
@@ -125,9 +125,9 @@
 
     def test_seed_runs(self):
         test_dicts = []
-        for i in range(1, 50):
+        for i in range(1, 10):
             base_dicts = []
-            for j in range(1, 50):
+            for j in range(1, 10):
                 base_dicts.append(make_dict(5, i * j))
             test_dicts.append(base_dicts)
         for test in test_dicts:


References