Merge "refstack client: improvement and fix of TestCase usage"
[functest.git] / functest / opnfv_tests / openstack / snaps / smoke.py
1 # Copyright (c) 2015 All rights reserved
2 # This program and the accompanying materials
3 # are made available under the terms of the Apache License, Version 2.0
4 # which accompanies this distribution, and is available at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7
8 import os
9 import unittest
10
11 from snaps import test_suite_builder
12
13 from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
14     SnapsTestRunner
15 from functest.utils.constants import CONST
16
17
18 class SnapsSmoke(SnapsTestRunner):
19     """
20     This test executes the Python Tests included with the SNAPS libraries
21     that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
22     and Nova
23     """
24     def __init__(self):
25         super(SnapsSmoke, self).__init__()
26
27         self.suite = unittest.TestSuite()
28         self.case_name = "snaps_smoke"
29         use_fip = CONST.snaps_use_floating_ips
30
31         # The snaps smoke test uses the same config as the
32         # snaps_health_check suite, so reuse it here
33         image_custom_config = None
34         if hasattr(CONST, 'snaps_health_check'):
35             image_custom_config = CONST.snaps_health_check
36
37         # Tests requiring floating IPs leverage files contained within the
38         # SNAPS repository and are found relative to that path
39         if use_fip:
40             snaps_dir = CONST.dir_repo_snaps + '/snaps'
41             os.chdir(snaps_dir)
42
43         test_suite_builder.add_openstack_integration_tests(
44             self.suite,
45             CONST.openstack_creds,
46             self.ext_net_name,
47             use_keystone=CONST.snaps_use_keystone,
48             flavor_metadata=self.flavor_metadata,
49             image_metadata=image_custom_config,
50             use_floating_ips=use_fip)