Redone the structure of test file tree
Made the test file more compatible with the one in upstream OpenStack by putting all tests to tests/unit and tests/functional directories. That brings the following pros: - Allows to run unit or functional tests separately - Allows to reuse existing CI jobs Partial-bug: #1476808 Change-Id: I322ddda5007a36db0e4376ea2eb5230a5fd4ed29
This commit is contained in:
parent
6ad5e0eb4d
commit
0d5928fd4f
@ -18,8 +18,8 @@ import cStringIO
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
from fuelclient.tests.unit.v2.cli import test_engine
|
||||||
from fuelclient.tests.utils import fake_env
|
from fuelclient.tests.utils import fake_env
|
||||||
from fuelclient.tests.v2.unit.cli import test_engine
|
|
||||||
from fuelclient.v1 import environment
|
from fuelclient.v1 import environment
|
||||||
|
|
||||||
|
|
@ -18,8 +18,8 @@ import cStringIO
|
|||||||
import mock
|
import mock
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from fuelclient.tests.unit.v2.cli import test_engine
|
||||||
from fuelclient.tests.utils import fake_fuel_version
|
from fuelclient.tests.utils import fake_fuel_version
|
||||||
from fuelclient.tests.v2.unit.cli import test_engine
|
|
||||||
|
|
||||||
|
|
||||||
class TestFuelVersionCommand(test_engine.BaseCLITest):
|
class TestFuelVersionCommand(test_engine.BaseCLITest):
|
@ -17,8 +17,8 @@
|
|||||||
import json
|
import json
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
from fuelclient.tests.unit.v2.cli import test_engine
|
||||||
from fuelclient.tests.utils import fake_network_group
|
from fuelclient.tests.utils import fake_network_group
|
||||||
from fuelclient.tests.v2.unit.cli import test_engine
|
|
||||||
from fuelclient.v1.network_group import NetworkGroupClient
|
from fuelclient.v1.network_group import NetworkGroupClient
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from fuelclient.tests.v2.unit.cli import test_engine
|
from fuelclient.tests.unit.v2.cli import test_engine
|
||||||
|
|
||||||
|
|
||||||
class TestNetworkTemplateCommand(test_engine.BaseCLITest):
|
class TestNetworkTemplateCommand(test_engine.BaseCLITest):
|
@ -17,8 +17,8 @@
|
|||||||
import mock
|
import mock
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from fuelclient.tests.unit.v2.cli import test_engine
|
||||||
from fuelclient.tests.utils import fake_node
|
from fuelclient.tests.utils import fake_node
|
||||||
from fuelclient.tests.v2.unit.cli import test_engine
|
|
||||||
from fuelclient.v1 import node
|
from fuelclient.v1 import node
|
||||||
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
from fuelclient.tests.unit.v2.cli import test_engine
|
||||||
from fuelclient.tests.utils import fake_task
|
from fuelclient.tests.utils import fake_task
|
||||||
from fuelclient.tests.v2.unit.cli import test_engine
|
|
||||||
|
|
||||||
|
|
||||||
class TestTaskCommand(test_engine.BaseCLITest):
|
class TestTaskCommand(test_engine.BaseCLITest):
|
@ -21,8 +21,8 @@ from fuelclient.cli import error
|
|||||||
from fuelclient.objects import base as base_object
|
from fuelclient.objects import base as base_object
|
||||||
from fuelclient.objects import environment as env_object
|
from fuelclient.objects import environment as env_object
|
||||||
from fuelclient.objects import task as task_object
|
from fuelclient.objects import task as task_object
|
||||||
|
from fuelclient.tests.unit.v2.lib import test_api
|
||||||
from fuelclient.tests import utils
|
from fuelclient.tests import utils
|
||||||
from fuelclient.tests.v2.unit.lib import test_api
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnvFacade(test_api.BaseLibTest):
|
class TestEnvFacade(test_api.BaseLibTest):
|
@ -15,8 +15,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import fuelclient
|
import fuelclient
|
||||||
|
from fuelclient.tests.unit.v2.lib import test_api
|
||||||
from fuelclient.tests import utils
|
from fuelclient.tests import utils
|
||||||
from fuelclient.tests.v2.unit.lib import test_api
|
|
||||||
|
|
||||||
|
|
||||||
class TestFuelVersionFacade(test_api.BaseLibTest):
|
class TestFuelVersionFacade(test_api.BaseLibTest):
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
import fuelclient
|
import fuelclient
|
||||||
from fuelclient.cli import error
|
from fuelclient.cli import error
|
||||||
|
from fuelclient.tests.unit.v2.lib import test_api
|
||||||
from fuelclient.tests import utils
|
from fuelclient.tests import utils
|
||||||
from fuelclient.tests.v2.unit.lib import test_api
|
|
||||||
|
|
||||||
|
|
||||||
class TestNetworkGroupFacade(test_api.BaseLibTest):
|
class TestNetworkGroupFacade(test_api.BaseLibTest):
|
@ -19,9 +19,9 @@ import yaml
|
|||||||
from oslo_serialization import jsonutils as json
|
from oslo_serialization import jsonutils as json
|
||||||
|
|
||||||
import fuelclient
|
import fuelclient
|
||||||
from fuelclient.tests.common.unit import \
|
from fuelclient.tests.unit.common import \
|
||||||
test_network_template as common_net_template
|
test_network_template as common_net_template
|
||||||
from fuelclient.tests.v2.unit.lib import test_api
|
from fuelclient.tests.unit.v2.lib import test_api
|
||||||
|
|
||||||
|
|
||||||
class TestNetworkTemplateFacade(test_api.BaseLibTest):
|
class TestNetworkTemplateFacade(test_api.BaseLibTest):
|
@ -19,8 +19,8 @@ import mock
|
|||||||
import fuelclient
|
import fuelclient
|
||||||
from fuelclient.cli import error
|
from fuelclient.cli import error
|
||||||
from fuelclient.objects import base as base_object
|
from fuelclient.objects import base as base_object
|
||||||
|
from fuelclient.tests.unit.v2.lib import test_api
|
||||||
from fuelclient.tests import utils
|
from fuelclient.tests import utils
|
||||||
from fuelclient.tests.v2.unit.lib import test_api
|
|
||||||
|
|
||||||
|
|
||||||
class TestNodeFacade(test_api.BaseLibTest):
|
class TestNodeFacade(test_api.BaseLibTest):
|
@ -15,8 +15,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import fuelclient
|
import fuelclient
|
||||||
|
from fuelclient.tests.unit.v2.lib import test_api
|
||||||
from fuelclient.tests import utils
|
from fuelclient.tests import utils
|
||||||
from fuelclient.tests.v2.unit.lib import test_api
|
|
||||||
|
|
||||||
|
|
||||||
class TestTaskFacade(test_api.BaseLibTest):
|
class TestTaskFacade(test_api.BaseLibTest):
|
28
run_tests.sh
28
run_tests.sh
@ -53,8 +53,8 @@ usage() {
|
|||||||
msg " -f --fetch-repo URI of a remote repo for fetching changes to fuel-web."
|
msg " -f --fetch-repo URI of a remote repo for fetching changes to fuel-web."
|
||||||
msg " If not specified, \$FETCH_REPO or nothing will be used."
|
msg " If not specified, \$FETCH_REPO or nothing will be used."
|
||||||
msg " -h, --help Print this usage message and exit."
|
msg " -h, --help Print this usage message and exit."
|
||||||
msg " -i --integration-tests Run only integration tests."
|
msg " -i --functional-tests Run only functional tests."
|
||||||
msg " -I --no-integration-tests Don't run integration tests."
|
msg " -I --no-functional-tests Don't run functional tests."
|
||||||
msg " -n --no-clone Do not clone fuel-web repo and use existing"
|
msg " -n --no-clone Do not clone fuel-web repo and use existing"
|
||||||
msg " one specified in \$FUEL_WEB_ROOT. Make sure it"
|
msg " one specified in \$FUEL_WEB_ROOT. Make sure it"
|
||||||
msg " does not have pending changes."
|
msg " does not have pending changes."
|
||||||
@ -86,7 +86,7 @@ process_options() {
|
|||||||
# Read the options
|
# Read the options
|
||||||
TEMP=$(getopt \
|
TEMP=$(getopt \
|
||||||
-o 67huUiInpPc:f:r:t:V: \
|
-o 67huUiInpPc:f:r:t:V: \
|
||||||
--long py26,py27,help,integration-tests,no-integration-tests,no-pep8,pep8,unit-tests,no-unit-tests,no-clone,client-version:,fuel-commit:,fetch-repo:,fetch-refspec:,tests: \
|
--long py26,py27,help,functional-tests,no-functional-tests,no-pep8,pep8,unit-tests,no-unit-tests,no-clone,client-version:,fuel-commit:,fetch-repo:,fetch-refspec:,tests: \
|
||||||
-n 'run_tests.sh' -- "$@")
|
-n 'run_tests.sh' -- "$@")
|
||||||
|
|
||||||
eval set -- "$TEMP"
|
eval set -- "$TEMP"
|
||||||
@ -103,8 +103,8 @@ process_options() {
|
|||||||
-t|--test) certain_tests+=("$2"); shift 2;;
|
-t|--test) certain_tests+=("$2"); shift 2;;
|
||||||
-p|--pep8) pep8_only=1; shift 1;;
|
-p|--pep8) pep8_only=1; shift 1;;
|
||||||
-P|--no-pep8) do_pep8=0; shift 1;;
|
-P|--no-pep8) do_pep8=0; shift 1;;
|
||||||
-i|--integration-tests) integration_tests=1; shift 1;;
|
-i|--functional-tests) functional_tests=1; shift 1;;
|
||||||
-I|--no-integration-tests) no_integration_tests=1; shift 1;;
|
-I|--no-functional-tests) no_functional_tests=1; shift 1;;
|
||||||
-u|--unit-tests) unit_tests=1; shift 1;;
|
-u|--unit-tests) unit_tests=1; shift 1;;
|
||||||
-U|--no-unit-tests) no_unit_tests=1; shift 1;;
|
-U|--no-unit-tests) no_unit_tests=1; shift 1;;
|
||||||
-V|--client-version) client_version+=("$2"); shift 2;;
|
-V|--client-version) client_version+=("$2"); shift 2;;
|
||||||
@ -122,15 +122,15 @@ process_options() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $unit_tests -eq 0 && \
|
if [[ $unit_tests -eq 0 && \
|
||||||
$integration_tests -eq 0 && \
|
$functional_tests -eq 0 && \
|
||||||
${#certain_tests[@]} -eq 0 ]]; then
|
${#certain_tests[@]} -eq 0 ]]; then
|
||||||
|
|
||||||
if [[ $no_unit_tests -ne 1 ]]; then
|
if [[ $no_unit_tests -ne 1 ]]; then
|
||||||
unit_tests=1
|
unit_tests=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $no_integration_tests -ne 1 ]]; then
|
if [[ $no_functional_tests -ne 1 ]]; then
|
||||||
integration_tests=1
|
functional_tests=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -147,10 +147,10 @@ process_options() {
|
|||||||
|
|
||||||
for version in ${client_version[@]}; do
|
for version in ${client_version[@]}; do
|
||||||
if [[ $unit_tests -eq 1 ]]; then
|
if [[ $unit_tests -eq 1 ]]; then
|
||||||
certain_tests+=("${ROOT}/fuelclient/tests/${version}/unit/")
|
certain_tests+=("${ROOT}/fuelclient/tests/unit/${version}/")
|
||||||
fi
|
fi
|
||||||
if [[ $integration_tests -eq 1 ]]; then
|
if [[ $functional_tests -eq 1 ]]; then
|
||||||
certain_tests+=("${ROOT}/fuelclient/tests/${version}/integration/")
|
certain_tests+=("${ROOT}/fuelclient/tests/functional/${version}/")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -419,8 +419,8 @@ init_default_params() {
|
|||||||
fetch_refspec=$FETCH_REFSPEC
|
fetch_refspec=$FETCH_REFSPEC
|
||||||
fetch_repo=$FETCH_REPO
|
fetch_repo=$FETCH_REPO
|
||||||
fuel_commit=$FUEL_COMMIT
|
fuel_commit=$FUEL_COMMIT
|
||||||
integration_tests=0
|
functional_tests=0
|
||||||
no_integration_tests=0
|
no_functional_tests=0
|
||||||
no_unit_tests=0
|
no_unit_tests=0
|
||||||
pep8_only=0
|
pep8_only=0
|
||||||
python_26=0
|
python_26=0
|
||||||
@ -446,7 +446,7 @@ run() {
|
|||||||
[[ $pep8_only -eq 1 ]] && exit $pep8_ret
|
[[ $pep8_only -eq 1 ]] && exit $pep8_ret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${certain_tests[@]}" == *"integration"* ]]; then
|
if [[ "${certain_tests[@]}" == *"functional"* ]]; then
|
||||||
prepare_env $config
|
prepare_env $config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user