Browse Source

Make rejectable_message_size configurable for log-api tests

When setting [service]max_log_size in the monasca-log-api
configuration to a value larger than the default (which is 1 MB
currently), the following tempest tests fail:

- monasca_tempest_tests.tests.log_api.test_constraints.\
  TestLogApiConstraints.test_should_reject_too_big_message
- monasca_tempest_tests.tests.log_api.test_constraints.\
  TestLogApiConstraints.test_should_reject_too_big_message_multiline

This happens because the tempest tests assume that the maximum log
size is 1 MB but that is not always the case because
[service]max_log_size can be increased to a larger value.

So add a new configuration option in tempest.conf under the
[monitoring] section to be able to set the maximum log size. This
option (called "log_api_max_log_size") should be set to the same value
than [service]max_log_size in the monasca-log-api configuration file.

Depends-On: https://review.openstack.org/#/c/634308/
Change-Id: I893c66fd640017e6cc94298207d771a3ac3b8053
Story: 2004944
Task: 29346
Thomas Bechtold 2 months ago
parent
commit
2bbd16e46d
2 changed files with 10 additions and 2 deletions
  1. 6
    1
      monasca_tempest_tests/config.py
  2. 4
    1
      monasca_tempest_tests/tests/log_api/base.py

+ 6
- 1
monasca_tempest_tests/config.py View File

@@ -54,5 +54,10 @@ MonitoringGroup = [
54 54
                help='monasca-log-api API version'),
55 55
     cfg.StrOpt('kibana_version',
56 56
                default='4.6.3',
57
-               help='Kibana version')
57
+               help='Kibana version'),
58
+    cfg.IntOpt('log_api_max_log_size',
59
+               default=1024 * 1024,
60
+               help=('Refers to payload/envelope size. This should be set '
61
+                     'to the same value as "[service]max_log_size" in the '
62
+                     'monasca-log-api configuration'))
58 63
 ]

+ 4
- 1
monasca_tempest_tests/tests/log_api/base.py View File

@@ -40,7 +40,10 @@ def _get_message_size(size_base):
40 40
 _SMALL_MESSAGE_SIZE = _get_message_size(0.001)
41 41
 _MEDIUM_MESSAGE_SIZE = _get_message_size(0.01)
42 42
 _LARGE_MESSAGE_SIZE = _get_message_size(0.1)
43
-_REJECTABLE_MESSAGE_SIZE = _get_message_size(1.1)
43
+# rejectable message must be larger than [service]max_log_size
44
+# from monasca-log-api.conf
45
+_reject_size = CONF.monitoring.log_api_max_log_size/_ONE_MB + 0.1
46
+_REJECTABLE_MESSAGE_SIZE = _get_message_size(_reject_size)
44 47
 
45 48
 
46 49
 def generate_unique_message(message=None, size=50):

Loading…
Cancel
Save