def test_create_multiple_clusters_failed(self, check_cluster): MULTIPLE_CLUSTERS = api_base.SAMPLE_CLUSTER.copy() MULTIPLE_CLUSTERS['count'] = 2 check_cluster.side_effect = exc.QuotaException( 'resource', 'requested', 'available') with testtools.ExpectedException(exc.QuotaException): api.create_cluster(api_base.SAMPLE_CLUSTER) self.assertEqual('Error', api.get_clusters()[0].status)
def _check_limits(req_limits): limits_name_map = { 'ram': _("RAM"), 'cpu': _("VCPU"), 'instances': _("instance"), 'floatingips': _("floating ip"), 'security_groups': _("security group"), 'security_group_rules': _("security group rule"), 'ports': _("port"), 'volumes': _("volume"), 'volume_gbs': _("volume storage") } avail_limits = _get_avail_limits() for quota, quota_name in six.iteritems(limits_name_map): if avail_limits[quota] < req_limits[quota]: raise ex.QuotaException(quota_name, req_limits[quota], avail_limits[quota])
def test_scale_cluster_failed(self, check_scaling, check_cluster): cluster = api.create_cluster(api_base.SAMPLE_CLUSTER) check_scaling.side_effect = exc.QuotaException( 'resource', 'requested', 'available') with testtools.ExpectedException(exc.QuotaException): api.scale_cluster(cluster.id, {})
def test_create_cluster_failed(self, check_cluster): check_cluster.side_effect = exc.QuotaException('resource', 'requested', 'available') with testtools.ExpectedException(exc.QuotaException): api.create_cluster(SAMPLE_CLUSTER) self.assertEqual('Error', api.get_clusters()[0].status)