Files
zaza-openstack-tests/zaza/openstack/charm_tests/manila/tests.py
2020-03-27 13:45:48 +01:00

45 lines
1.4 KiB
Python

#!/usr/bin/env python3
# Copyright 2019 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Encapsulate Manila testing."""
import tenacity
from manilaclient import client as manilaclient
import zaza.openstack.charm_tests.test_utils as test_utils
class ManilaTests(test_utils.OpenStackBaseTest):
"""Encapsulate Manila tests."""
@classmethod
def setUpClass(cls):
"""Run class setup for running tests."""
super(ManilaTests, cls).setUpClass()
cls.manila_client = manilaclient.Client(
session=cls.keystone_session, client_version='2')
def test_manila_api(self):
"""Test that the Manila API is working."""
self.assertEqual([], self._list_shares())
@tenacity.retry(
stop=tenacity.stop_after_attempt(5),
wait=tenacity.wait_exponential(multiplier=3, min=2, max=10))
def _list_shares(self):
return self.manila_client.shares.list()