move all functional tests to tests module

functional tests should be grouped with other tests (unit and
integration tests). as part of this commit the "common" module
was renamed to just "base", this was done for simplicity.

the post_test_hook.sh file was also copied to the functional module
since it should live there. a separate change to the infra repo
will be made to call the new location, once that is merged we
can remove the old one (a new change will also be posted for that)

Needed-By: I49d54f009021d65c1ae49faf6b3f0a7acdadd7b3
Change-Id: Ie8c334f6223373b8e06df8bd8466500d2a2c8ede
This commit is contained in:
Steve Martinelli 2016-09-05 20:35:06 -07:00
parent 39839def2e
commit c14d3efe61
82 changed files with 138 additions and 95 deletions

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.common import test
from openstackclient.tests.functional import base
class AvailabilityZoneTests(test.TestCase):
class AvailabilityZoneTests(base.TestCase):
"""Functional tests for availability zone. """
HEADERS = ["'Zone Name'"]
# So far, all components have the same default availability zone name.

View File

@ -12,14 +12,14 @@
import os
from functional.common import test
from openstackclient.common import configuration
from openstackclient.tests.functional import base
BASIC_CONFIG_HEADERS = ['Field', 'Value']
class ConfigurationTests(test.TestCase):
class ConfigurationTests(base.TestCase):
opts = "-f value -c auth.password"

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.common import test
from openstackclient.tests.functional import base
class HelpTests(test.TestCase):
class HelpTests(base.TestCase):
"""Functional tests for openstackclient help output."""
SERVER_COMMANDS = [

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.common import test
from openstackclient.tests.functional import base
class QuotaTests(test.TestCase):
class QuotaTests(base.TestCase):
"""Functional tests for quota. """
# Test quota information for compute, network and volume.
EXPECTED_FIELDS = ['instances', 'networks', 'volumes']

View File

@ -12,10 +12,10 @@
import hashlib
from functional.common import test
from openstackclient.tests.functional import base
class ComputeAgentTests(test.TestCase):
class ComputeAgentTests(base.TestCase):
"""Functional tests for compute agent."""
ID = None

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class AggregateTests(test.TestCase):
class AggregateTests(base.TestCase):
"""Functional tests for aggregate."""
NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class FlavorTests(test.TestCase):
class FlavorTests(base.TestCase):
"""Functional tests for flavor."""
NAME = uuid.uuid4().hex

View File

@ -12,13 +12,13 @@
import tempfile
from functional.common import test
from openstackclient.tests.functional import base
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
class KeypairBase(test.TestCase):
class KeypairBase(base.TestCase):
"""Methods for functional tests."""
def keypair_create(self, name=data_utils.rand_uuid()):

View File

@ -14,11 +14,11 @@ import time
from tempest.lib.common.utils import data_utils
from functional.common import test
from openstackclient.tests.functional import base
from tempest.lib import exceptions
class ServerTests(test.TestCase):
class ServerTests(base.TestCase):
"""Functional tests for openstack server commands."""
@classmethod

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class ServerGroupTests(test.TestCase):
class ServerGroupTests(base.TestCase):
"""Functional tests for servergroup."""
NAME = uuid.uuid4().hex

View File

@ -10,19 +10,19 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.common import test
from openstackclient.tests.functional import base
class ExampleTests(test.TestCase):
class ExampleTests(base.TestCase):
"""Functional tests for running examples."""
def test_common(self):
# NOTE(stevemar): If an examples has a non-zero return
# code, then execute will raise an error by default.
test.execute('python', test.EXAMPLE_DIR + '/common.py --debug')
base.execute('python', base.EXAMPLE_DIR + '/common.py --debug')
def test_object_api(self):
test.execute('python', test.EXAMPLE_DIR + '/object_api.py --debug')
base.execute('python', base.EXAMPLE_DIR + '/object_api.py --debug')
def test_osc_lib(self):
test.execute('python', test.EXAMPLE_DIR + '/osc-lib.py --debug')
base.execute('python', base.EXAMPLE_DIR + '/osc-lib.py --debug')

View File

@ -14,12 +14,12 @@ import os
from tempest.lib.common.utils import data_utils
from functional.common import test
from openstackclient.tests.functional import base
BASIC_LIST_HEADERS = ['ID', 'Name']
class IdentityTests(test.TestCase):
class IdentityTests(base.TestCase):
"""Functional tests for Identity commands. """
USER_FIELDS = ['email', 'enabled', 'id', 'name', 'project_id',

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class CatalogTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class EC2CredentialsTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class EndpointTests(common.IdentityTests):

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class ProjectTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class RoleTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class ServiceTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class TokenTests(common.IdentityTests):

View File

@ -13,7 +13,7 @@
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
from functional.tests.identity.v2 import common
from openstackclient.tests.functional.identity.v2 import common
class UserTests(common.IdentityTests):

View File

@ -14,13 +14,13 @@ import os
from tempest.lib.common.utils import data_utils
from functional.common import test
from openstackclient.tests.functional import base
BASIC_LIST_HEADERS = ['ID', 'Name']
class IdentityTests(test.TestCase):
class IdentityTests(base.TestCase):
"""Functional tests for Identity commands. """
DOMAIN_FIELDS = ['description', 'enabled', 'id', 'name', 'links']

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class CatalogTests(common.IdentityTests):

View File

@ -13,7 +13,7 @@
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class DomainTests(common.IdentityTests):

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class EndpointTests(common.IdentityTests):

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class GroupTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
from tempest.lib.common.utils import data_utils

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class ProjectTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class RegionTests(common.IdentityTests):

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class RoleTests(common.IdentityTests):

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class ServiceTests(common.IdentityTests):

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
from tempest.lib.common.utils import data_utils

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class TokenTests(common.IdentityTests):

View File

@ -12,7 +12,7 @@
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v3 import common
from openstackclient.tests.functional.identity.v3 import common
class UserTests(common.IdentityTests):

View File

@ -13,10 +13,10 @@
import os
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class ImageTests(test.TestCase):
class ImageTests(base.TestCase):
"""Functional tests for image. """
NAME = uuid.uuid4().hex

View File

@ -13,10 +13,10 @@
import os
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class ImageTests(test.TestCase):
class ImageTests(base.TestCase):
"""Functional tests for image. """
NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class AddressScopeTests(test.TestCase):
class AddressScopeTests(base.TestCase):
"""Functional tests for address scope. """
NAME = uuid.uuid4().hex
HEADERS = ['Name']

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class FloatingIpTests(test.TestCase):
class FloatingIpTests(base.TestCase):
"""Functional tests for floating ip. """
SUBNET_NAME = uuid.uuid4().hex
NETWORK_NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class IPAvailabilityTests(test.TestCase):
class IPAvailabilityTests(base.TestCase):
"""Functional tests for IP availability. """
NAME = uuid.uuid4().hex
NETWORK_NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class NetworkTests(test.TestCase):
class NetworkTests(base.TestCase):
"""Functional tests for network. """
NAME = uuid.uuid4().hex
HEADERS = ['Name']

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from functional.common import test
from openstackclient.tests.functional import base
class NetworkAgentTests(test.TestCase):
class NetworkAgentTests(base.TestCase):
"""Functional tests for network agent. """
IDs = None
HEADERS = ['ID']

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class NetworkRBACTests(test.TestCase):
class NetworkRBACTests(base.TestCase):
"""Functional tests for network rbac. """
NET_NAME = uuid.uuid4().hex
PROJECT_NAME = uuid.uuid4().hex

View File

@ -13,12 +13,12 @@
import testtools
import uuid
from functional.common import test
from openstackclient.tests.functional import base
# NOTE(rtheis): Routed networks is still a WIP and not enabled by default.
@testtools.skip("bp/routed-networks")
class NetworkSegmentTests(test.TestCase):
class NetworkSegmentTests(base.TestCase):
"""Functional tests for network segment. """
NETWORK_NAME = uuid.uuid4().hex
PHYSICAL_NETWORK_NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class PortTests(test.TestCase):
class PortTests(base.TestCase):
"""Functional tests for port. """
NAME = uuid.uuid4().hex
NETWORK_NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class RouterTests(test.TestCase):
class RouterTests(base.TestCase):
"""Functional tests for router. """
NAME = uuid.uuid4().hex
HEADERS = ['Name']

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class SecurityGroupTests(test.TestCase):
class SecurityGroupTests(base.TestCase):
"""Functional tests for security group. """
NAME = uuid.uuid4().hex
OTHER_NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class SecurityGroupRuleTests(test.TestCase):
class SecurityGroupRuleTests(base.TestCase):
"""Functional tests for security group rule. """
SECURITY_GROUP_NAME = uuid.uuid4().hex
SECURITY_GROUP_RULE_ID = None

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class SubnetTests(test.TestCase):
class SubnetTests(base.TestCase):
"""Functional tests for subnet. """
NAME = uuid.uuid4().hex
NETWORK_NAME = uuid.uuid4().hex

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class SubnetPoolTests(test.TestCase):
class SubnetPoolTests(base.TestCase):
"""Functional tests for subnet pool. """
NAME = uuid.uuid4().hex
CREATE_POOL_PREFIX = '10.100.0.0/24'

View File

@ -12,10 +12,10 @@
import uuid
from functional.common import test
from openstackclient.tests.functional import base
class ContainerTests(test.TestCase):
class ContainerTests(base.TestCase):
"""Functional tests for object containers. """
NAME = uuid.uuid4().hex

View File

@ -14,14 +14,14 @@ import os
import tempfile
import uuid
from functional.common import test
from openstackclient.tests.functional import base
BASIC_LIST_HEADERS = ['Name']
CONTAINER_FIELDS = ['account', 'container', 'x-trans-id']
OBJECT_FIELDS = ['object', 'container', 'etag']
class ObjectTests(test.TestCase):
class ObjectTests(base.TestCase):
"""Functional tests for Object commands. """
CONTAINER_NAME = uuid.uuid4().hex

View File

@ -0,0 +1,43 @@
#!/bin/bash
# This is a script that kicks off a series of functional tests against an
# OpenStack cloud. It will attempt to create an instance if one is not
# available. Do not run this script unless you know what you're doing.
# For more information refer to:
# http://docs.openstack.org/developer/python-openstackclient/
function generate_testr_results {
if [ -f .testrepository/0 ]; then
sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
sudo .tox/functional/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
sudo gzip -9 $BASE/logs/testrepository.subunit
sudo gzip -9 $BASE/logs/testr_results.html
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
fi
}
OPENSTACKCLIENT_DIR=$(cd $(dirname "$0") && pwd)
sudo chown -R jenkins:stack $OPENSTACKCLIENT_DIR
# Run tests
echo "Running openstackclient functional test suite"
set +e
# Go to the openstackclient dir
cd $OPENSTACKCLIENT_DIR
# Source environment variables to kick things off
source ~stack/devstack/openrc admin admin
echo 'Running tests with:'
env | grep OS
# Preserve env for OS_ credentials
sudo -E -H -u jenkins tox -efunctional
EXIT_CODE=$?
set -e
# Collect and parse result
generate_testr_results
exit $EXIT_CODE

View File

@ -12,10 +12,10 @@
import os
from functional.common import test
from openstackclient.tests.functional import base
class BaseVolumeTests(test.TestCase):
class BaseVolumeTests(base.TestCase):
"""Base class for Volume functional tests. """
@classmethod

View File

@ -12,7 +12,7 @@
import uuid
from functional.tests.volume.v1 import common
from openstackclient.tests.functional.volume.v1 import common
class QosTests(common.BaseVolumeTests):

View File

@ -12,7 +12,7 @@
import uuid
from functional.tests.volume.v1 import common
from openstackclient.tests.functional.volume.v1 import common
class VolumeTests(common.BaseVolumeTests):

View File

@ -13,7 +13,7 @@
import time
import uuid
from functional.tests.volume.v1 import common
from openstackclient.tests.functional.volume.v1 import common
class VolumeTypeTests(common.BaseVolumeTests):

View File

@ -12,10 +12,10 @@
import os
from functional.common import test
from openstackclient.tests.functional import base
class BaseVolumeTests(test.TestCase):
class BaseVolumeTests(base.TestCase):
"""Base class for Volume functional tests. """
@classmethod

View File

@ -12,7 +12,7 @@
import uuid
from functional.tests.volume.v2 import common
from openstackclient.tests.functional.volume.v2 import common
class QosTests(common.BaseVolumeTests):

View File

@ -13,7 +13,7 @@
import time
import uuid
from functional.tests.volume.v2 import common
from openstackclient.tests.functional.volume.v2 import common
class SnapshotTests(common.BaseVolumeTests):

View File

@ -13,7 +13,7 @@
import time
import uuid
from functional.tests.volume.v2 import common
from openstackclient.tests.functional.volume.v2 import common
class VolumeTests(common.BaseVolumeTests):

View File

@ -13,7 +13,7 @@
import time
import uuid
from functional.tests.volume.v2 import common
from openstackclient.tests.functional.volume.v2 import common
class VolumeTypeTests(common.BaseVolumeTests):

View File

@ -51,7 +51,7 @@ commands =
bandit -r openstackclient -x tests -s B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101
[testenv:functional]
setenv = OS_TEST_PATH=./functional/tests
setenv = OS_TEST_PATH=./openstackclient/tests/functional
passenv = OS_*
[testenv:venv]