~gnuoy/charms/trusty/nova-compute/no-hugepages

« back to all changes in this revision

Viewing changes to tests/basic_deployment.py

[tribaal, r=gnuoy] This branch introduces a new api-rate-limit-rules charm config option controlling the rate-limiting 
of the nova API by writing the passed value to the /etc/nova/api-paste.ini file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    def _configure_services(self):
69
69
        """Configure all of the services."""
70
70
        nova_config = {'config-flags': 'auto_assign_floating_ip=False',
71
 
                       'enable-live-migration': 'False'}
 
71
                       'enable-live-migration': 'False',
 
72
                       'api-rate-limit-rules':
 
73
                            '( POST, *, .*, 9999, MINUTE );'}
72
74
        nova_cc_config = {}
73
75
        if self.git:
74
76
            amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
466
468
                message = "nova config error: {}".format(ret)
467
469
                amulet.raise_status(amulet.FAIL, msg=message)
468
470
 
 
471
    def test_api_paste_config(self):
 
472
        """Check that the rate limiting is set on the nova api (for POSTs)."""
 
473
        unit = self.nova_compute_sentry
 
474
        conf = '/etc/nova/api-paste.ini'
 
475
        section = "filter:ratelimit"
 
476
        factory = ("nova.api.openstack.compute.limits:RateLimitingMiddleware"
 
477
                   ".factory")
 
478
        expected = {"paste.filter_factory": factory,
 
479
                    "limits": "( POST, *, .*, 9999, MINUTE );"}
 
480
        ret = u.validate_config_data(unit, conf, section, expected)
 
481
        if ret:
 
482
            message = "api paste config error: {}".format(ret)
 
483
            amulet.raise_status(amulet.FAIL, msg=message)
 
484
 
469
485
    def test_image_instance_create(self):
470
486
        """Create an image/instance, verify they exist, and delete them."""
471
487
        # NOTE(coreycb): Skipping failing test on essex until resolved. essex