Browse Source

Fixed framework error handling issues. Changed casing for Yii and AsyncIO

Steven Smith 9 years ago
parent
commit
b98effd7b0
67 changed files with 24 additions and 21 deletions
  1. 1 0
      .travis.yml
  2. 0 0
      frameworks/PHP/yii2/.gitignore
  3. 0 0
      frameworks/PHP/yii2/README.md
  4. 0 0
      frameworks/PHP/yii2/app/controllers/SiteController.php
  5. 0 0
      frameworks/PHP/yii2/app/index.php
  6. 0 0
      frameworks/PHP/yii2/app/runtime/keys.json
  7. 0 0
      frameworks/PHP/yii2/benchmark_config.json
  8. 0 0
      frameworks/PHP/yii2/composer.json
  9. 0 0
      frameworks/PHP/yii2/composer.lock
  10. 0 0
      frameworks/PHP/yii2/deploy/config.hdf
  11. 0 0
      frameworks/PHP/yii2/deploy/nginx.conf
  12. 0 0
      frameworks/PHP/yii2/hhvm.pid
  13. 0 0
      frameworks/PHP/yii2/setup.sh
  14. 0 0
      frameworks/PHP/yii2/setup_hhvm.sh
  15. 0 0
      frameworks/Python/asyncio/README.md
  16. 0 0
      frameworks/Python/asyncio/aiohttp.web/.gitignore
  17. 0 0
      frameworks/Python/asyncio/aiohttp.web/LICENSE
  18. 0 0
      frameworks/Python/asyncio/aiohttp.web/README.rst
  19. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/default/hello
  20. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/hello/api_hour/gunicorn_conf.py
  21. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/hello/api_hour/logging.ini
  22. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/hello/main/main.yaml
  23. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/init.d/hello
  24. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/logrotate.d/hello
  25. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/monit/conf.d/hello
  26. 0 0
      frameworks/Python/asyncio/aiohttp.web/etc/rsyslog.conf
  27. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/__init__.py
  28. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/endpoints/__init__.py
  29. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/endpoints/world.py
  30. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/services/__init__.py
  31. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/services/redis.py
  32. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/services/world.py
  33. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/templates/fortunes.html.j2
  34. 0 0
      frameworks/Python/asyncio/aiohttp.web/hello/utils/__init__.py
  35. 0 0
      frameworks/Python/asyncio/aiohttp.web/setup.sh
  36. 0 0
      frameworks/Python/asyncio/aiohttp.web/source_code
  37. 0 0
      frameworks/Python/asyncio/benchmark_config.json
  38. 0 0
      frameworks/Python/asyncio/requirements.txt
  39. 0 0
      frameworks/Python/asyncio/yocto_http/.gitignore
  40. 0 0
      frameworks/Python/asyncio/yocto_http/LICENSE
  41. 0 0
      frameworks/Python/asyncio/yocto_http/README.rst
  42. 0 0
      frameworks/Python/asyncio/yocto_http/etc/default/hello
  43. 0 0
      frameworks/Python/asyncio/yocto_http/etc/hello/api_hour/gunicorn_conf.py
  44. 0 0
      frameworks/Python/asyncio/yocto_http/etc/hello/api_hour/logging.ini
  45. 0 0
      frameworks/Python/asyncio/yocto_http/etc/hello/main/main.yaml
  46. 0 0
      frameworks/Python/asyncio/yocto_http/etc/init.d/hello
  47. 0 0
      frameworks/Python/asyncio/yocto_http/etc/logrotate.d/hello
  48. 0 0
      frameworks/Python/asyncio/yocto_http/etc/monit/conf.d/hello
  49. 0 0
      frameworks/Python/asyncio/yocto_http/etc/rsyslog.conf
  50. 0 0
      frameworks/Python/asyncio/yocto_http/hello/__init__.py
  51. 0 0
      frameworks/Python/asyncio/yocto_http/hello/endpoints/__init__.py
  52. 0 0
      frameworks/Python/asyncio/yocto_http/hello/endpoints/world.py
  53. 0 0
      frameworks/Python/asyncio/yocto_http/hello/servers/__init__.py
  54. 0 0
      frameworks/Python/asyncio/yocto_http/hello/servers/yocto_http.py
  55. 0 0
      frameworks/Python/asyncio/yocto_http/hello/services/__init__.py
  56. 0 0
      frameworks/Python/asyncio/yocto_http/hello/services/redis.py
  57. 0 0
      frameworks/Python/asyncio/yocto_http/hello/services/world.py
  58. 0 0
      frameworks/Python/asyncio/yocto_http/hello/templates/fortunes.html.j2
  59. 0 0
      frameworks/Python/asyncio/yocto_http/hello/utils/__init__.py
  60. 0 0
      frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/__init__.py
  61. 0 0
      frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/application.py
  62. 0 0
      frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/request.py
  63. 0 0
      frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/utils.py
  64. 0 0
      frameworks/Python/asyncio/yocto_http/setup.sh
  65. 0 0
      frameworks/Python/asyncio/yocto_http/source_code
  66. 3 2
      toolset/benchmark/test_types/framework_test_type.py
  67. 20 19
      toolset/benchmark/test_types/verifications.py

+ 1 - 0
.travis.yml

@@ -200,6 +200,7 @@ addons:
       - mysql-server
 
 before_script:
+  - sudo echo "lower_case_table_names = 1" >> /etc/mysql/my.cnf
   - mysql -uroot < config/create.sql
 
 script:

+ 0 - 0
frameworks/PHP/Yii2/.gitignore → frameworks/PHP/yii2/.gitignore


+ 0 - 0
frameworks/PHP/Yii2/README.md → frameworks/PHP/yii2/README.md


+ 0 - 0
frameworks/PHP/Yii2/app/controllers/SiteController.php → frameworks/PHP/yii2/app/controllers/SiteController.php


+ 0 - 0
frameworks/PHP/Yii2/app/index.php → frameworks/PHP/yii2/app/index.php


+ 0 - 0
frameworks/PHP/Yii2/app/runtime/keys.json → frameworks/PHP/yii2/app/runtime/keys.json


+ 0 - 0
frameworks/PHP/Yii2/benchmark_config.json → frameworks/PHP/yii2/benchmark_config.json


+ 0 - 0
frameworks/PHP/Yii2/composer.json → frameworks/PHP/yii2/composer.json


+ 0 - 0
frameworks/PHP/Yii2/composer.lock → frameworks/PHP/yii2/composer.lock


+ 0 - 0
frameworks/PHP/Yii2/deploy/config.hdf → frameworks/PHP/yii2/deploy/config.hdf


+ 0 - 0
frameworks/PHP/Yii2/deploy/nginx.conf → frameworks/PHP/yii2/deploy/nginx.conf


+ 0 - 0
frameworks/PHP/Yii2/hhvm.pid → frameworks/PHP/yii2/hhvm.pid


+ 0 - 0
frameworks/PHP/Yii2/setup.sh → frameworks/PHP/yii2/setup.sh


+ 0 - 0
frameworks/PHP/Yii2/setup_hhvm.sh → frameworks/PHP/yii2/setup_hhvm.sh


+ 0 - 0
frameworks/Python/AsyncIO/README.md → frameworks/Python/asyncio/README.md


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/.gitignore → frameworks/Python/asyncio/aiohttp.web/.gitignore


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/LICENSE → frameworks/Python/asyncio/aiohttp.web/LICENSE


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/README.rst → frameworks/Python/asyncio/aiohttp.web/README.rst


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/default/hello → frameworks/Python/asyncio/aiohttp.web/etc/default/hello


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/hello/api_hour/gunicorn_conf.py → frameworks/Python/asyncio/aiohttp.web/etc/hello/api_hour/gunicorn_conf.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/hello/api_hour/logging.ini → frameworks/Python/asyncio/aiohttp.web/etc/hello/api_hour/logging.ini


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/hello/main/main.yaml → frameworks/Python/asyncio/aiohttp.web/etc/hello/main/main.yaml


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/init.d/hello → frameworks/Python/asyncio/aiohttp.web/etc/init.d/hello


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/logrotate.d/hello → frameworks/Python/asyncio/aiohttp.web/etc/logrotate.d/hello


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/monit/conf.d/hello → frameworks/Python/asyncio/aiohttp.web/etc/monit/conf.d/hello


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/etc/rsyslog.conf → frameworks/Python/asyncio/aiohttp.web/etc/rsyslog.conf


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/__init__.py → frameworks/Python/asyncio/aiohttp.web/hello/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/endpoints/__init__.py → frameworks/Python/asyncio/aiohttp.web/hello/endpoints/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/endpoints/world.py → frameworks/Python/asyncio/aiohttp.web/hello/endpoints/world.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/services/__init__.py → frameworks/Python/asyncio/aiohttp.web/hello/services/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/services/redis.py → frameworks/Python/asyncio/aiohttp.web/hello/services/redis.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/services/world.py → frameworks/Python/asyncio/aiohttp.web/hello/services/world.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/templates/fortunes.html.j2 → frameworks/Python/asyncio/aiohttp.web/hello/templates/fortunes.html.j2


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/hello/utils/__init__.py → frameworks/Python/asyncio/aiohttp.web/hello/utils/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/setup.sh → frameworks/Python/asyncio/aiohttp.web/setup.sh


+ 0 - 0
frameworks/Python/AsyncIO/aiohttp.web/source_code → frameworks/Python/asyncio/aiohttp.web/source_code


+ 0 - 0
frameworks/Python/AsyncIO/benchmark_config.json → frameworks/Python/asyncio/benchmark_config.json


+ 0 - 0
frameworks/Python/AsyncIO/requirements.txt → frameworks/Python/asyncio/requirements.txt


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/.gitignore → frameworks/Python/asyncio/yocto_http/.gitignore


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/LICENSE → frameworks/Python/asyncio/yocto_http/LICENSE


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/README.rst → frameworks/Python/asyncio/yocto_http/README.rst


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/default/hello → frameworks/Python/asyncio/yocto_http/etc/default/hello


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/hello/api_hour/gunicorn_conf.py → frameworks/Python/asyncio/yocto_http/etc/hello/api_hour/gunicorn_conf.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/hello/api_hour/logging.ini → frameworks/Python/asyncio/yocto_http/etc/hello/api_hour/logging.ini


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/hello/main/main.yaml → frameworks/Python/asyncio/yocto_http/etc/hello/main/main.yaml


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/init.d/hello → frameworks/Python/asyncio/yocto_http/etc/init.d/hello


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/logrotate.d/hello → frameworks/Python/asyncio/yocto_http/etc/logrotate.d/hello


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/monit/conf.d/hello → frameworks/Python/asyncio/yocto_http/etc/monit/conf.d/hello


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/etc/rsyslog.conf → frameworks/Python/asyncio/yocto_http/etc/rsyslog.conf


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/__init__.py → frameworks/Python/asyncio/yocto_http/hello/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/endpoints/__init__.py → frameworks/Python/asyncio/yocto_http/hello/endpoints/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/endpoints/world.py → frameworks/Python/asyncio/yocto_http/hello/endpoints/world.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/servers/__init__.py → frameworks/Python/asyncio/yocto_http/hello/servers/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/servers/yocto_http.py → frameworks/Python/asyncio/yocto_http/hello/servers/yocto_http.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/services/__init__.py → frameworks/Python/asyncio/yocto_http/hello/services/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/services/redis.py → frameworks/Python/asyncio/yocto_http/hello/services/redis.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/services/world.py → frameworks/Python/asyncio/yocto_http/hello/services/world.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/templates/fortunes.html.j2 → frameworks/Python/asyncio/yocto_http/hello/templates/fortunes.html.j2


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/utils/__init__.py → frameworks/Python/asyncio/yocto_http/hello/utils/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/utils/yocto_http/__init__.py → frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/__init__.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/utils/yocto_http/application.py → frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/application.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/utils/yocto_http/request.py → frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/request.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/hello/utils/yocto_http/utils.py → frameworks/Python/asyncio/yocto_http/hello/utils/yocto_http/utils.py


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/setup.sh → frameworks/Python/asyncio/yocto_http/setup.sh


+ 0 - 0
frameworks/Python/AsyncIO/yocto_http/source_code → frameworks/Python/asyncio/yocto_http/source_code


+ 3 - 2
toolset/benchmark/test_types/framework_test_type.py

@@ -90,7 +90,8 @@ class FrameworkTestType:
         body = r.content
         self.out.write(str(headers))
         self.out.write(body)
-        print "  Response: \"%s\"" % body
+        b = 40
+        print "  Response (trimmed to %d bytes): \"%s\"" % (b, body.strip()[:b])
         return headers, body
 
     def verify(self, base_url):
@@ -118,7 +119,7 @@ class FrameworkTestType:
         '''Returns the URL for this test, like '/json'''
         # This is a method because each test type uses a different key
         # for their URL so the base class can't know which arg is the URL
-        raise NotImplementedError("Subclasses must provide verify")
+        raise NotImplementedError("Subclasses must provide get_url")
 
     def copy(self):
         '''

+ 20 - 19
toolset/benchmark/test_types/verifications.py

@@ -48,30 +48,31 @@ def verify_headers(headers, url, should_be='json'):
 
     problems = []
 
-    if any(v.lower() not in headers for v in ('Server', 'Date', 'Content-Type')):
+    for v in (v for v in ('Server', 'Date', 'Content-Type') if v.lower() not in headers):
         problems.append(
             ('warn', 'Required response header missing: %s' % v, url))
-    elif all(v.lower() not in headers for v in ('Content-Length', 'Transfer-Encoding')):
+
+    if all(v.lower() not in headers for v in ('Content-Length', 'Transfer-Encoding')):
         problems.append(
             ('warn',
              'Required response size header missing, please include either "Content-Length" or "Transfer-Encoding"',
              url))
-    else:
-        content_type = headers.get('Content-Type', None)
 
-        if content_type.lower() == includes_charset:
-            problems.append(
-                ('warn',
-                 ("Content encoding found \"%s\" where \"%s\" is acceptable.\n"
-                  "Additional response bytes may negatively affect benchmark performance."
-                  % (includes_charset, expected_type)),
-                 url))
-        elif content_type != expected_type:
-            problems.append(
-                ('warn',
-                 'Unexpected content encoding, found \"%s\", expected \"%s\"' % (
-                     content_type, expected_type),
-                 url))
+    content_type = headers.get('Content-Type', None)
+
+    if content_type.lower() == includes_charset:
+        problems.append(
+            ('warn',
+             ("Content encoding found \"%s\" where \"%s\" is acceptable.\n"
+              "Additional response bytes may negatively affect benchmark performance."
+              % (includes_charset, expected_type)),
+             url))
+    elif content_type != expected_type:
+        problems.append(
+            ('warn',
+             'Unexpected content encoding, found \"%s\", expected \"%s\"' % (
+                 content_type, expected_type),
+             url))
     return problems
 
 
@@ -125,12 +126,12 @@ def verify_randomnumber_object(db_object, url, max_infraction='fail'):
     db_object = {k.lower(): v for k, v in db_object.iteritems()}
     required_keys = set(['id', 'randomnumber'])
 
-    if any(v not in db_object for v in required_keys):
+    for v in (v for v in required_keys if v not in db_object):
         problems.append(
             (max_infraction, 'Response object was missing required key: %s' % v, url))
 
     if len(db_object) > len(required_keys):
-        extras = db_object.keys() - required_keys
+        extras = set(db_object.keys()) - required_keys
         problems.append(
             ('warn',
              'An extra key(s) is being included with the db object: %s' % ', '.join(