Пример #1
0
def get_windows_action_manager(client):
    """Get the OS specific Action Manager."""
    LOG.info("Waiting for boot completion in order to select an "
             "Action Manager ...")

    conf = util.get_config()
    username = conf.openstack.image_username
    wait_cmd = ('(Get-WmiObject Win32_Account | '
                'where -Property Name -contains {0}).Name'.format(username))
    client.run_command_until_condition(
        wait_cmd,
        lambda stdout: stdout.strip() == username,
        retry_count=util.RETRY_COUNT,
        delay=util.RETRY_DELAY,
        command_type=util.POWERSHELL)

    # get os type
    product_type = _get_product_type(client)
    major_version = _get_major_version(client)
    windows_type = util.WINDOWS_VERSION.get((major_version, product_type),
                                            util.WINDOWS)
    is_nanoserver = _is_nanoserver(client)

    if isinstance(windows_type, dict):
        windows_type = windows_type[is_nanoserver]

    LOG.debug(("We got the OS type %s because we have the major Version : %d,"
               "The product Type : %d, and IsNanoserver: %d"), windows_type,
              major_version, product_type, is_nanoserver)

    action_manager = WindowsActionManagers[windows_type]
    conf = util.get_config()
    return action_manager(client=client, config=conf)
Пример #2
0
def get_windows_action_manager(client):
    """Get the OS specific Action Manager."""
    LOG.info("Waiting for boot completion in order to select an "
             "Action Manager ...")

    conf = util.get_config()
    username = conf.openstack.image_username
    wait_boot_completion(client, username)

    # get os type
    product_type = _get_product_type(client)
    major_version = _get_major_version(client)
    windows_type = util.WINDOWS_VERSION.get((major_version, product_type),
                                            util.WINDOWS)
    is_nanoserver = _is_nanoserver(client)

    if isinstance(windows_type, dict):
        windows_type = windows_type[is_nanoserver]

    LOG.debug(("We got the OS type %s because we have the major Version : %d,"
               "The product Type : %d, and IsNanoserver: %d"), windows_type,
              major_version, product_type, is_nanoserver)

    action_manager = WindowsActionManagers[windows_type]
    conf = util.get_config()
    return action_manager(client=client, config=conf)
Пример #3
0
    def __new__(mcs, name, bases, attrs):
        cls = super(ScenarioMeta, mcs).__new__(mcs, name, bases, attrs)
        test_loader = unittest.TestLoader()
        if not cls.is_final():
            LOG.warning("Class %s is not a final class", cls)
            return cls

        cls.conf = util.get_config()
        for test_class in cls.test_classes:
            test_names = test_loader.getTestCaseNames(test_class)
            for test_name in test_names:

                # skip tests that have required_service_type != cls.service_type
                test_obj = getattr(test_class, test_name)
                if hasattr(test_obj, 'required_service_type'):
                    if test_obj.required_service_type != cls.service_type:
                        continue

                def delegator(self,
                              class_name=test_class,
                              test_name=test_name):
                    getattr(
                        class_name(cls.conf, self.backend, self.recipe,
                                   self.introspection, test_name), test_name)()

                if hasattr(cls, test_name):
                    test_name = 'test_%s_%s' % (test_class.__name__, test_name)

                # Create a new function from the delegator with the
                # correct name, since tools such as nose test runner,
                # will use func.func_name, which will be delegator otherwise.
                new_func = _build_new_function(delegator, test_name)
                setattr(cls, test_name, new_func)

        return cls
Пример #4
0
    def __new__(mcs, name, bases, attrs):
        cls = super(ScenarioMeta, mcs).__new__(mcs, name, bases, attrs)
        test_loader = unittest.TestLoader()
        if not cls.is_final():
            LOG.warning("Class %s is not a final class", cls)
            return cls

        cls.conf = util.get_config()
        for test_class in cls.test_classes:
            test_names = test_loader.getTestCaseNames(test_class)
            for test_name in test_names:

                # skip tests that have required_service_type != cls.service_type
                test_obj = getattr(test_class, test_name)
                if hasattr(test_obj, 'required_service_type'):
                    if test_obj.required_service_type != cls.service_type:
                        continue

                def delegator(self, class_name=test_class,
                              test_name=test_name):
                    getattr(class_name(cls.conf, self.backend, self.recipe,
                                       self.introspection, test_name),
                            test_name)()

                if hasattr(cls, test_name):
                    test_name = 'test_%s_%s' % (test_class.__name__,
                                                test_name)

                # Create a new function from the delegator with the
                # correct name, since tools such as nose test runner,
                # will use func.func_name, which will be delegator otherwise.
                new_func = _build_new_function(delegator, test_name)
                setattr(cls, test_name, new_func)

        return cls
Пример #5
0
#    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.
"""Base recipee for preparing instances for cloudbaseinit testing."""

import abc

import six

from argus.recipees import base
from argus import util

__all__ = ('BaseCloudbaseinitRecipee', )

CONF = util.get_config()
LOG = util.get_logger()


@six.add_metaclass(abc.ABCMeta)
class BaseCloudbaseinitRecipee(base.BaseRecipee):
    """Base recipee for testing an instance with Cloudbaseinit.

    The method :meth:`~prepare` does all the necessary work for
    preparing a new instance. The executed steps are:

    * wait for boot completion.
    * get an install script for CloudbaseInit
    * installs CloudbaseInit
    * waits for the finalization of the installation.
    """
Пример #6
0
from argus.tests.cloud import smoke
from argus.tests.cloud.windows import test_smoke
from argus import util


def _availability_zones():
    api_manager = manager.APIManager()
    try:
        zones = api_manager.availability_zone_client.list_availability_zones()
        info = zones['availabilityZoneInfo']
        return {zone['zoneName'] for zone in info}
    finally:
        api_manager.cleanup_credentials()

AVAILABILITY_ZONES = _availability_zones()
CONFIG = util.get_config()


class BaseWindowsScenario(scenarios.CloudScenario):

    backend_type = tempest_backend.BaseWindowsTempestBackend
    introspection_type = introspection.InstanceIntrospection
    recipe_type = recipe.CloudbaseinitRecipe


class ScenarioSmoke(BaseWindowsScenario):

    test_classes = (test_smoke.TestSmoke, )


class ScenarioSmokeHeat(BaseWindowsScenario):
Пример #7
0
from argus.tests.cloud.windows import test_smoke
from argus import util


def _availability_zones():
    api_manager = manager.APIManager()
    try:
        zones = api_manager.availability_zone_client.list_availability_zones()
        info = zones['availabilityZoneInfo']
        return {zone['zoneName'] for zone in info}
    finally:
        api_manager.cleanup_credentials()


AVAILABILITY_ZONES = _availability_zones()
CONFIG = util.get_config()


class BaseWindowsScenario(scenarios.CloudScenario):

    backend_type = tempest_backend.BaseWindowsTempestBackend
    introspection_type = introspection.InstanceIntrospection
    recipe_type = recipe.CloudbaseinitRecipe


class ScenarioSmoke(BaseWindowsScenario):

    test_classes = (test_smoke.TestSmoke, )


class ScenarioSmokeHeat(BaseWindowsScenario):