Преглед изворни кода

Stresstests: Adds -J option to not join tasks

Ask Solem пре 11 година
родитељ
комит
a1e0896d65

+ 8 - 2
funtests/stress/rabbit-restart-loop.sh

@@ -1,7 +1,13 @@
 #!/usr/bin/env bash
 
+secs=${1:-30}
+secs=$((secs - 1))
+
 while true; do
-    sudo rabbitmqctl stop_app
     sudo rabbitmqctl start_app
-    sleep 10
+    echo "sleep for ${secs}s"
+    sleep $secs
+    sudo rabbitmqctl stop_app
+    echo "sleep for 1s"
+    sleep 1
 done

+ 4 - 1
funtests/stress/stress/__main__.py

@@ -34,7 +34,10 @@ class Stress(Command):
                    help='Specify test group (all|green)'),
             Option('--diag', default=False, action='store_true',
                    help='Enable diagnostics (slow)',
-            )
+            ),
+            Option('-J', '--no-join', default=False, action='store_true',
+                   help='Do not wait for task results',
+            ),
         )
 
 

+ 5 - 2
funtests/stress/stress/suite.py

@@ -117,7 +117,8 @@ class Suite(object):
 
     def run(self, names=None, iterations=50, offset=0,
             numtests=None, list_all=False, repeat=0, group='all',
-            diag=False, **kw):
+            diag=False, no_join=False, **kw):
+        self.no_join = no_join
         self.fbi.enable(diag)
         tests = self.filtertests(group, names)[offset:numtests or None]
         if list_all:
@@ -266,6 +267,8 @@ class Suite(object):
         return [res.id for res in r if res.id not in res.backend._cache]
 
     def join(self, r, propagate=False, max_retries=5, **kwargs):
+        if self.no_join:
+            return
         received = []
 
         def on_result(task_id, value):
@@ -280,7 +283,7 @@ class Suite(object):
                 self.speaker.beep()
                 marker(
                     'Still waiting for {0}/{1}: [{2}]: {3!r}'.format(
-                        len(received), len(r),
+                        len(r) - len(received), len(r),
                         ','.join(waiting_for), exc), '!',
                 )
                 self.fbi.diag(waiting_for)

+ 5 - 0
funtests/stress/stress/templates.py

@@ -81,3 +81,8 @@ class pickle(default):
     CELERY_ACCEPT_CONTENT = ['pickle', 'json']
     CELERY_TASK_SERIALIZER = 'pickle'
     CELERY_RESULT_SERIALIZER = 'pickle'
+
+
+@template()
+class confirms(default):
+    BROKER_TRANSPORT_OPTIONS = {'confirm_publish': True}