summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile32
-rw-r--r--docker/Dockerfile.aarch6430
-rw-r--r--docs/com/pres/framework/framework.md3
-rw-r--r--docs/testing/user/configguide/configguide.rst64
-rw-r--r--functest/ci/config_functest.yaml2
-rwxr-xr-xfunctest/ci/prepare_env.py44
-rw-r--r--functest/cli/cli_base.py6
-rw-r--r--functest/cli/commands/cli_env.py27
-rw-r--r--functest/cli/commands/cli_os.py28
-rw-r--r--functest/cli/setup.py15
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py5
-rw-r--r--functest/tests/unit/ci/test_prepare_env.py15
-rw-r--r--functest/tests/unit/cli/commands/test_cli_os.py74
-rw-r--r--functest/tests/unit/cli/test_cli_base.py7
-rw-r--r--functest/utils/decorators.py7
-rwxr-xr-xfunctest/utils/openstack_clean.py1
-rwxr-xr-xfunctest/utils/openstack_snapshot.py1
-rw-r--r--kingbird_requirements.txt15
-rw-r--r--requirements.py3.txt39
-rw-r--r--requirements.txt10
-rw-r--r--setup.cfg15
-rw-r--r--setup.py24
-rw-r--r--tox.ini10
23 files changed, 128 insertions, 346 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 4c8205ae3..d18c6c97d 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -66,9 +66,9 @@ sshpass \
wget \
--no-install-recommends
-RUN pip install --upgrade pip && easy_install -U setuptools==35.0.2
+RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
-RUN mkdir -p ${REPOS_DIR} \
+RUN mkdir -p ${FUNCTEST_REPO_DIR} \
&& mkdir -p ${REPOS_VNFS_DIR} \
&& mkdir -p ${FUNCTEST_BASE_DIR}/results \
&& mkdir -p ${FUNCTEST_CONF_DIR} \
@@ -79,8 +79,16 @@ RUN mkdir -p ${REPOS_DIR} \
RUN git config --global http.sslVerify false
+RUN pip install \
+ git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
+ git+https://gerrit.opnfv.org/gerrit/releng@$BRANCH#egg=opnfv\&subdirectory=modules \
+ git+https://gerrit.opnfv.org/gerrit/barometer@$BRANCH#egg=baro_tests \
+ git+https://gerrit.opnfv.org/gerrit/snaps@$BRANCH#egg=snaps
+
+# Hook required by hardcoded paths in Functest
+RUN ln -s /usr/local/lib/python2.7/dist-packages/functest ${FUNCTEST_REPO_DIR}/functest
+
# OPNFV repositories
-RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/functest ${REPOS_DIR}/functest
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${REPOS_DIR}/copper
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sdnvpn ${REPOS_DIR}/sdnvpn
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino ${REPOS_DIR}/domino
@@ -108,33 +116,28 @@ RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_
RUN pip install -r ${REPOS_DIR}/rally/requirements.txt
RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
-
-RUN cd ${FUNCTEST_REPO_DIR} \
- && pip install -r requirements.txt \
- && pip install -e .
-
RUN pip install ${REPOS_DIR}/opera
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
-not -path "*tests/unit*" \
-not -path "*functest_venv*" \
|xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \
- && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+ && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
-not -path "*functest_venv*" \
|xargs grep -L \#\! |cut -d\: -f 1 |xargs chmod -c 644
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
-not -path "*tests/unit*" \
-not -path "*functest_venv*" \
|xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
- && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+ && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
-not -path "*functest_venv*" \
|xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755
RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
RUN ${REPOS_DIR}/rally/install_rally.sh --yes
-RUN /bin/bash ${REPOS_DIR}/functest/docker/add_images.sh
+RUN add_images.sh
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
@@ -148,8 +151,7 @@ RUN cd ${REPOS_DIR}/sdnvpn && pip install -e .
RUN cd ${REPOS_DIR}/bgpvpn && pip install -e .
# Kingbird integration
-RUN cd ${REPOS_DIR}/kingbird && pip install -e .
-RUN cd ${FUNCTEST_REPO_DIR} && pip install -r kingbird_requirements.txt
+RUN cd ${REPOS_DIR}/kingbird && pip install -e . -r test-requirements.txt
# refstack-client integration
RUN cd ${REPOS_DIR}/refstack-client && ./setup_env -t ${REFSTACK_TAG}
diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64
index c35500fa0..eea475a8f 100644
--- a/docker/Dockerfile.aarch64
+++ b/docker/Dockerfile.aarch64
@@ -65,9 +65,9 @@ sshpass \
wget \
--no-install-recommends
-RUN pip install --upgrade pip && easy_install -U setuptools==35.0.2
+RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
-RUN mkdir -p ${REPOS_DIR} \
+RUN mkdir -p ${FUNCTEST_REPO_DIR} \
&& mkdir -p ${REPOS_VNFS_DIR} \
&& mkdir -p ${FUNCTEST_BASE_DIR}/results \
&& mkdir -p ${FUNCTEST_BASE_DIR}/conf \
@@ -78,8 +78,16 @@ RUN mkdir -p ${REPOS_DIR} \
RUN git config --global http.sslVerify false
+RUN pip install \
+ git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
+ git+https://gerrit.opnfv.org/gerrit/releng@$BRANCH#egg=opnfv\&subdirectory=modules \
+ git+https://gerrit.opnfv.org/gerrit/barometer@$BRANCH#egg=baro_tests \
+ git+https://gerrit.opnfv.org/gerrit/snaps@$BRANCH#egg=snaps
+
+# Hook required by hardcoded paths in Functest
+RUN ln -s /usr/local/lib/python2.7/dist-packages/functest ${FUNCTEST_REPO_DIR}/functest
+
# OPNFV repositories
-RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/functest ${REPOS_DIR}/functest
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${REPOS_DIR}/copper
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sdnvpn ${REPOS_DIR}/sdnvpn
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino ${REPOS_DIR}/domino
@@ -105,30 +113,26 @@ RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_
RUN pip install -r ${REPOS_DIR}/rally/requirements.txt
RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
-RUN cd ${FUNCTEST_REPO_DIR} \
- && pip install -r requirements.txt \
- && pip install -e .
-
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
-not -path "*tests/unit*" \
-not -path "*functest_venv*" \
|xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \
- && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+ && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
-not -path "*functest_venv*" \
|xargs grep -L \#\! |cut -d\: -f 1 |xargs chmod -c 644
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
-not -path "*tests/unit*" \
-not -path "*functest_venv*" \
|xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
- && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+ && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
-not -path "*functest_venv*" \
|xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755
RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
RUN ${REPOS_DIR}/rally/install_rally.sh --yes
-RUN /bin/bash ${REPOS_DIR}/functest/docker/add_images.sh
+RUN add_images.sh
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
@@ -144,7 +148,7 @@ RUN cd ${REPOS_DIR}/sdnvpn && pip install -e .
RUN cd ${REPOS_DIR}/bgpvpn && pip install -e .
# Kingbird integration
-RUN cd ${REPOS_DIR}/kingbird && pip install -e .
+RUN cd ${REPOS_DIR}/kingbird && pip install -e . -r test-requirements.txt
# refstack-client integration
RUN cd ${REPOS_DIR}/refstack-client && ./setup_env -t ${REFSTACK_TAG}
diff --git a/docs/com/pres/framework/framework.md b/docs/com/pres/framework/framework.md
index d6a01de06..dfd7a2155 100644
--- a/docs/com/pres/framework/framework.md
+++ b/docs/com/pres/framework/framework.md
@@ -2,7 +2,7 @@
created by [Cédric Ollivier](mailto:cedric.ollivier@orange.com)
-2017/05/06
+2017/06/05
Note:
@@ -313,7 +313,6 @@ run:
- __to finish VNF abstraction (coverage + pylint)__
- to publish doc API
-- to manage criteria as written in testcases.yaml
Please see [Functest Euphrates page](https://wiki.opnfv.org/display/functest/Functest+Euphrates+page) for more details
diff --git a/docs/testing/user/configguide/configguide.rst b/docs/testing/user/configguide/configguide.rst
index 12dfd1059..61fc45933 100644
--- a/docs/testing/user/configguide/configguide.rst
+++ b/docs/testing/user/configguide/configguide.rst
@@ -41,51 +41,24 @@ scope and responsibility of the OPNFV project.
Accessing the Openstack credentials
-----------------------------------
-OpenStack credentials are mandatory and can be retrieved in different
-ways. From inside the running Functest docker container the
-"functest env prepare" command will automatically look for the
-Openstack credentials file "/home/opnfv/functest/conf/openstack.creds"
-and retrieve it unless the file already exists. This Functest
-environment preparation step is described later in this document.
-
-WARNING: When the installer type is "joid" you have to have the
-credentials file inside the running container **before** initiating the
-functest environment preparation. For that reason you have to choose
-either one of the options below, since the automated copying does not
-work for "joid".
-
-You can also specifically pass in the needed file prior to running the
-environment preparation either:
-
- * by using the -v option when creating the Docker container. This is
- referred to in docker documentation as "Bind Mounting". See the
- usage of this parameter in the following chapter.
- * or creating a local file '/home/opnfv/functest/conf/openstack.creds'
- inside the running container with the credentials in it. Consult
+OpenStack credentials are mandatory and must be provided to Functest.
+When running the command "functest env prepare", the framework will
+automatically look for the Openstack credentials file
+"/home/opnfv/functest/conf/openstack.creds" and will exit with
+error if it is not present or it is empty.
+
+There are 2 ways to provide that file:
+
+ * by using a Docker volume with -v option when creating the Docker container.
+ This is referred to in docker documentation as "Bind Mounting".
+ See the usage of this parameter in the following chapter.
+ * or creating manually the file '/home/opnfv/functest/conf/openstack.creds'
+ inside the running container and pasting the credentials in it. Consult
your installer guide for further details. This is however not
instructed in this document.
-NOTE: When the installer type is "fuel" and virtualized deployment
-is used, there you have to explicitly fetch the credentials file
-executing the following sequence
-
- #. Create a container as described in next chapter but do not
- "Bind Mount" the credentials
- #. Log in to container and execute the following command. Replace
- the IP with installer address after the "-a" parameter::
-
- fetch_os_creds.sh \
- -d /home/opnfv/functest/conf/openstack.creds \
- -i fuel \
- -a 10.20.0.2 \
- -v
- ( -d specifies the full path to the Openstack credential file
- -i specifies the INSTALLER_TYPE
- -a specifies the INSTALLER_IP
- -v indicates a virtualized environment and takes no arguments )
-
- #. Continue with your testing, initiate functest environment
- preparation, run tests etc.
+There is a default environment variable in the Functest container **$creds**
+that points to the credentials absolute path to help the user with this task.
In proxified environment you may need to change the credentials file.
There are some tips in chapter: `Proxy support`_
@@ -108,9 +81,10 @@ recommended parameters for invoking docker container
-e "INSTALLER_IP=<Specific IP Address>"
- This IP is needed to fetch RC file from deployment, fetch logs, ...
- If not provided, there is no way to fetch the RC file. It must be
- provided manually as a volume
+ These two env variables are useful extract some information
+ from the deployment. However, for some test cases like
+ SFC or Barometer they are mandatory since the tests
+ need to access the installer node and the deployment.
#. Credentials for accessing the Openstack.
Most convenient way of passing them to container is by having a
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 5aa5bfdab..1b2c83800 100644
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -130,7 +130,7 @@ tempest:
tenant_name: tempest
tenant_description: Tenant for Tempest test suite
user_name: tempest
- user_password: tempest
+ user_password: Tempest123!
validation:
ssh_timeout: 130
object_storage:
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index e03bc6547..9e53e30bd 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -83,11 +83,9 @@ def check_env_variables():
% CONST.__getattribute__('INSTALLER_TYPE'))
if CONST.__getattribute__('INSTALLER_IP') is None:
- logger.warning("The env variable 'INSTALLER_IP' is not defined. "
- "It is needed to fetch the OpenStack credentials. "
- "If the credentials are not provided to the "
- "container as a volume, please add this env variable "
- "to the 'docker run' command.")
+ logger.warning(
+ "The env variable 'INSTALLER_IP' is not defined. It is recommended"
+ " to extract some information from the deployment")
else:
logger.info(" INSTALLER_IP=%s" %
CONST.__getattribute__('INSTALLER_IP'))
@@ -177,7 +175,6 @@ def create_directories():
def source_rc_file():
print_separator()
- logger.info("Fetching RC file...")
if CONST.__getattribute__('openstack_creds') is None:
logger.warning("The environment variable 'creds' must be set and"
@@ -187,38 +184,17 @@ def source_rc_file():
CONST.__getattribute__('dir_functest_conf'), 'openstack.creds')
if not os.path.isfile(CONST.__getattribute__('openstack_creds')):
- logger.info("RC file not provided. "
- "Fetching it from the installer...")
- if CONST.__getattribute__('INSTALLER_IP')is None:
- logger.error("The env variable 'INSTALLER_IP' must be provided in"
- " order to fetch the credentials from the installer.")
- raise Exception("Missing CI_INSTALLER_IP.")
- if (CONST.__getattribute__('INSTALLER_TYPE') not in
- opnfv_constants.INSTALLERS):
- logger.error("Cannot fetch credentials. INSTALLER_TYPE=%s is "
- "not a valid OPNFV installer. Available "
- "installers are : %s." %
- (CONST.__getattribute__('INSTALLER_TYPE'),
- opnfv_constants.INSTALLERS))
- raise Exception("Wrong INSTALLER_TYPE.")
-
- cmd = ("/home/opnfv/repos/releng/utils/fetch_os_creds.sh "
- "-d %s -i %s -a %s"
- % (CONST.__getattribute__('openstack_creds'),
- CONST.__getattribute__('INSTALLER_TYPE'),
- CONST.__getattribute__('INSTALLER_IP')))
- logger.debug("Executing command: %s" % cmd)
- p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
- output = p.communicate()[0]
- logger.debug("\n%s" % output)
- if p.returncode != 0:
- raise Exception("Failed to fetch credentials from installer.")
+ raise Exception(
+ "OpenStack credentials file not provided. "
+ "The OpenStack credentials must be in {}"
+ .format(CONST.__getattribute__('openstack_creds')))
else:
logger.info("RC file provided in %s."
% CONST.__getattribute__('openstack_creds'))
if os.path.getsize(CONST.__getattribute__('openstack_creds')) == 0:
- raise Exception("The file %s is empty." %
- CONST.__getattribute__('openstack_creds'))
+ raise Exception(
+ "The OpenStack RC file {} is empty."
+ .format(CONST.__getattribute__('openstack_creds')))
logger.info("Sourcing the OpenStack RC file...")
os_utils.source_credentials(CONST.__getattribute__('openstack_creds'))
diff --git a/functest/cli/cli_base.py b/functest/cli/cli_base.py
index 2104e125c..2f085834c 100644
--- a/functest/cli/cli_base.py
+++ b/functest/cli/cli_base.py
@@ -86,12 +86,6 @@ def os_show_credentials():
_openstack.show_credentials()
-@openstack.command('fetch-rc', help="Fetch the OpenStack RC file from "
- "the installer.")
-def os_fetch_rc():
- _openstack.fetch_credentials()
-
-
@env.command('prepare', help="Prepares the Functest environment. This step is "
"needed run the tests.")
def env_prepare():
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index f5ba4b342..b43116fcd 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -11,6 +11,7 @@ import os
import click
import git
+import prettytable
from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
@@ -66,21 +67,19 @@ class CliEnv(object):
if self.status(verbose=False) == 0:
STATUS = "ready"
- click.echo("+======================================================+")
- click.echo("| Functest Environment info |")
- click.echo("+======================================================+")
- click.echo("| INSTALLER: %s|" % installer_info.ljust(41))
- click.echo("| SCENARIO: %s|" % scenario.ljust(41))
- click.echo("| POD: %s|" % node.ljust(41))
- click.echo("| GIT BRACNH: %s|" % git_branch.ljust(41))
- click.echo("| GIT HASH: %s|" % git_hash.ljust(41))
+ msg = prettytable.PrettyTable(
+ header_style='upper', padding_width=5,
+ field_names=['Functest Environment', 'value'])
+ msg.add_row(['INSTALLER', installer_info])
+ msg.add_row(['SCENARIO', scenario])
+ msg.add_row(['POD', node])
+ msg.add_row(['GIT BRANCH', git_branch])
+ msg.add_row(['GIT HASH', git_hash])
if build_tag:
- click.echo("| BUILD TAG: %s|" % build_tag.ljust(41))
- click.echo("| DEBUG FLAG: %s|" % is_debug.ljust(41))
- click.echo("+------------------------------------------------------+")
- click.echo("| STATUS: %s|" % STATUS.ljust(41))
- click.echo("+------------------------------------------------------+")
- click.echo("")
+ msg.add_row(['BUILD TAG', build_tag])
+ msg.add_row(['DEBUG FLAG', is_debug])
+ msg.add_row(['STATUS', STATUS])
+ click.echo(msg.get_string())
def status(self, verbose=True):
ret_val = 0
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py
index 5e6e1109a..c66362fce 100644
--- a/functest/cli/commands/cli_os.py
+++ b/functest/cli/commands/cli_os.py
@@ -47,34 +47,6 @@ class CliOpenStack(object):
if key.startswith('OS_'):
click.echo("{}={}".format(key, value))
- def fetch_credentials(self):
- if os.path.isfile(self.openstack_creds):
- answer = raw_input("It seems the RC file is already present. "
- "Do you want to overwrite it? [y|n]\n")
- while True:
- if answer.lower() in ["y", "yes"]:
- break
- elif answer.lower() in ["n", "no"]:
- return
- else:
- answer = raw_input("Invalid answer. Please type [y|n]\n")
-
- installer_type = CONST.__getattribute__('INSTALLER_TYPE')
- if installer_type is None:
- click.echo("The environment variable 'INSTALLER_TYPE' is not"
- "defined. Please export it")
- installer_ip = CONST.__getattribute__('INSTALLER_IP')
- if installer_ip is None:
- click.echo("The environment variable 'INSTALLER_IP' is not"
- "defined. Please export it")
- cmd = ("fetch_os_creds.sh -d %s -i %s -a %s"
- % (self.openstack_creds,
- installer_type,
- installer_ip))
- click.echo("Fetching credentials from installer node '%s' with IP=%s.."
- % (installer_type, installer_ip))
- ft_utils.execute_command(cmd, verbose=False)
-
def check(self):
self.ping_endpoint()
cmd = os.path.join(CONST.__getattribute__('dir_repo_functest'),
diff --git a/functest/cli/setup.py b/functest/cli/setup.py
deleted file mode 100644
index 21547e158..000000000
--- a/functest/cli/setup.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from setuptools import setup
-
-setup(
- name='functest',
- version='colorado.0.1',
- py_modules=['cli_base'],
- include_package_data=True,
- install_requires=[
- 'click',
- ],
- entry_points='''
- [console_scripts]
- functest=cli_base:cli
- ''',
-)
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 15365ccff..4eb5661e9 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -290,6 +290,11 @@ def configure_tempest_update_params(tempest_conf_file,
config.set('identity', 'password',
CONST.__getattribute__('tempest_identity_user_password'))
config.set('identity', 'region', 'RegionOne')
+ if os_utils.is_keystone_v3():
+ auth_version = 'v3'
+ else:
+ auth_version = 'v2'
+ config.set('identity', 'auth_version', auth_version)
config.set(
'validation', 'ssh_timeout',
CONST.__getattribute__('tempest_validation_ssh_timeout'))
diff --git a/functest/tests/unit/ci/test_prepare_env.py b/functest/tests/unit/ci/test_prepare_env.py
index 85d1918d8..f3e15a013 100644
--- a/functest/tests/unit/ci/test_prepare_env.py
+++ b/functest/tests/unit/ci/test_prepare_env.py
@@ -47,14 +47,9 @@ class PrepareEnvTesting(unittest.TestCase):
prepare_env.check_env_variables()
mock_logger_info.assert_any_call("Checking environment variables"
"...")
- mock_logger_warn.assert_any_call("The env variable 'INSTALLER_IP'"
- " is not defined. It is needed to"
- " fetch the OpenStack credentials."
- " If the credentials are not"
- " provided to the container as a"
- " volume, please add this env"
- " variable to the 'docker run'"
- " command.")
+ mock_logger_warn.assert_any_call(
+ "The env variable 'INSTALLER_IP' is not defined. It is recommended"
+ " to extract some information from the deployment")
@mock.patch('functest.ci.prepare_env.logger.info')
@mock.patch('functest.ci.prepare_env.logger.warning')
@@ -272,8 +267,8 @@ class PrepareEnvTesting(unittest.TestCase):
mock.patch('functest.ci.prepare_env.subprocess.Popen') \
as mock_subproc_popen, \
self.assertRaises(Exception):
- CONST.__setattr__('openstack_creds', 'test_creds')
- CONST.__setattr__('INSTALLER_IP', None)
+ CONST.__setattr__('openstack_creds', None)
+ CONST.__setattr__('INSTALLER_IP', 'test_ip')
CONST.__setattr__('INSTALLER_TYPE', 'test_type')
opnfv_constants.INSTALLERS = ['test_type']
diff --git a/functest/tests/unit/cli/commands/test_cli_os.py b/functest/tests/unit/cli/commands/test_cli_os.py
index b551ee4d2..c3285ecbe 100644
--- a/functest/tests/unit/cli/commands/test_cli_os.py
+++ b/functest/tests/unit/cli/commands/test_cli_os.py
@@ -62,80 +62,6 @@ class CliOpenStackTesting(unittest.TestCase):
mock_exit.assert_called_once_with(0)
@mock.patch('functest.cli.commands.cli_os.ft_utils.execute_command')
- @mock.patch('functest.cli.commands.cli_os.os.path.isfile',
- return_value=False)
- @mock.patch('functest.cli.commands.cli_os.click.echo')
- def test_fetch_credentials_default(self, mock_click_echo,
- mock_os_path,
- mock_ftutils_execute):
- CONST.__setattr__('INSTALLER_TYPE', self.installer_type)
- CONST.__setattr__('INSTALLER_IP', self.installer_ip)
- cmd = ("fetch_os_creds.sh -d %s -i %s -a %s"
- % (self.openstack_creds,
- self.installer_type,
- self.installer_ip))
- self.cli_os.openstack_creds = self.openstack_creds
- self.cli_os.fetch_credentials()
- mock_click_echo.assert_called_once_with("Fetching credentials from "
- "installer node '%s' with "
- "IP=%s.." %
- (self.installer_type,
- self.installer_ip))
- mock_ftutils_execute.assert_called_once_with(cmd, verbose=False)
-
- @mock.patch('functest.cli.commands.cli_os.ft_utils.execute_command')
- @mock.patch('functest.cli.commands.cli_os.os.path.isfile',
- return_value=False)
- @mock.patch('functest.cli.commands.cli_os.click.echo')
- def test_fetch_credentials_missing_installer_type(self, mock_click_echo,
- mock_os_path,
- mock_ftutils_execute):
- CONST.__setattr__('INSTALLER_TYPE', None)
- CONST.__setattr__('INSTALLER_IP', self.installer_ip)
- cmd = ("fetch_os_creds.sh -d %s -i %s -a %s"
- % (self.openstack_creds,
- None,
- self.installer_ip))
- self.cli_os.openstack_creds = self.openstack_creds
- self.cli_os.fetch_credentials()
- mock_click_echo.assert_any_call("The environment variable "
- "'INSTALLER_TYPE' is not"
- "defined. Please export it")
- mock_click_echo.assert_any_call("Fetching credentials from "
- "installer node '%s' with "
- "IP=%s.." %
- (None,
- self.installer_ip))
- mock_ftutils_execute.assert_called_once_with(cmd, verbose=False)
-
- @mock.patch('functest.cli.commands.cli_os.ft_utils.execute_command')
- @mock.patch('functest.cli.commands.cli_os.os.path.isfile',
- return_value=False)
- @mock.patch('functest.cli.commands.cli_os.click.echo')
- def test_fetch_credentials_missing_installer_ip(self, mock_click_echo,
- mock_os_path,
- mock_ftutils_execute):
- installer_type = self.installer_type
- installer_ip = None
- CONST.__setattr__('INSTALLER_TYPE', installer_type)
- CONST.__setattr__('INSTALLER_IP', installer_ip)
- cmd = ("fetch_os_creds.sh -d %s -i %s -a %s"
- % (self.openstack_creds,
- installer_type,
- installer_ip))
- self.cli_os.openstack_creds = self.openstack_creds
- self.cli_os.fetch_credentials()
- mock_click_echo.assert_any_call("The environment variable "
- "'INSTALLER_IP' is not"
- "defined. Please export it")
- mock_click_echo.assert_any_call("Fetching credentials from "
- "installer node '%s' with "
- "IP=%s.." %
- (installer_type,
- installer_ip))
- mock_ftutils_execute.assert_called_once_with(cmd, verbose=False)
-
- @mock.patch('functest.cli.commands.cli_os.ft_utils.execute_command')
def test_check(self, mock_ftutils_execute):
with mock.patch.object(self.cli_os, 'ping_endpoint'):
CONST.__setattr__('dir_repo_functest', self.dir_repo_functest)
diff --git a/functest/tests/unit/cli/test_cli_base.py b/functest/tests/unit/cli/test_cli_base.py
index 896032795..61bd093e6 100644
--- a/functest/tests/unit/cli/test_cli_base.py
+++ b/functest/tests/unit/cli/test_cli_base.py
@@ -62,13 +62,6 @@ class CliBaseTesting(unittest.TestCase):
self.assertEqual(result.exit_code, 0)
self.assertTrue(mock_method.called)
- def test_os_fetch_rc(self):
- with mock.patch.object(self._openstack, 'fetch_credentials') \
- as mock_method:
- result = self.runner.invoke(cli_base.os_fetch_rc)
- self.assertEqual(result.exit_code, 0)
- self.assertTrue(mock_method.called)
-
def test_env_prepare(self):
with mock.patch.object(self._env, 'prepare') as mock_method:
result = self.runner.invoke(cli_base.env_prepare)
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 73e0a3520..230a99e75 100644
--- a/functest/utils/decorators.py
+++ b/functest/utils/decorators.py
@@ -1,5 +1,12 @@
#!/usr/bin/env python
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
# pylint: disable=missing-docstring
import errno
diff --git a/functest/utils/openstack_clean.py b/functest/utils/openstack_clean.py
index cdd918521..0ce087987 100755
--- a/functest/utils/openstack_clean.py
+++ b/functest/utils/openstack_clean.py
@@ -425,6 +425,7 @@ def main():
separator()
remove_tenants(keystone_client, default_tenants)
separator()
+ return 0
if __name__ == '__main__':
diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py
index 8f1d3b9b2..233c316a8 100755
--- a/functest/utils/openstack_snapshot.py
+++ b/functest/utils/openstack_snapshot.py
@@ -160,6 +160,7 @@ def main():
% yaml_file.read())
logger.debug("NOTE: These objects will NOT be deleted after " +
"running the test.")
+ return 0
if __name__ == '__main__':
diff --git a/kingbird_requirements.txt b/kingbird_requirements.txt
deleted file mode 100644
index adf1082cb..000000000
--- a/kingbird_requirements.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-ddt==1.1.1
-oslosphinx==4.11.0
-oslotest==2.14.0
-pylint==1.4.5
-requests-mock==1.3.0
-tempest-lib==1.0.0
-testresources==2.0.1
-testscenarios==0.5.0
diff --git a/requirements.py3.txt b/requirements.py3.txt
deleted file mode 100644
index 6a003d532..000000000
--- a/requirements.py3.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-pyyaml==3.10
-gitpython==1.0.1
-python-openstackclient==2.3.0
-python-ceilometerclient==2.6.2
-python-heatclient==1.7.0
-python-keystoneclient==3.5.0
-python-neutronclient==6.0.0
-python-novaclient==6.0.0
-python-congressclient==1.5.0
-python-tackerclient==0.7.0
-pexpect==4.0
-requests==2.9.1
-robotframework==3.0.2
-robotframework-httplibrary==0.4.2
-robotframework-requests==0.4.7
-jmespath==0.9.2
-configObj==5.0.6
-Flask==0.10.1
-xmltodict==0.9.2
-scp==0.10.2
-paramiko==2.1.2
-shyaml
-dnspython
-Pillow==3.3.0
-click==6.6
-openbaton-cli==2.2.1-beta7
-mock==1.3.0
-iniparse==0.4
-PrettyTable>=0.7.1,<0.8 # BSD
-six>=1.9.0 # MIT
-git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
-git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
diff --git a/requirements.txt b/requirements.txt
index ef6b2f1c8..787aeaf4a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -20,14 +20,14 @@ requests==2.9.1
robotframework==3.0.2
robotframework-httplibrary==0.4.2
robotframework-requests==0.4.7
-robotframework-sshlibrary==2.1.3
+robotframework-sshlibrary==2.1.3; python_version=='2.7'
jmespath==0.9.2
configObj==5.0.6
Flask==0.10.1
xmltodict==0.9.2
scp==0.10.2
paramiko==2.1.2
-subprocess32
+subprocess32; python_version=='2.7'
shyaml
dnspython
Pillow==3.3.0
@@ -37,6 +37,6 @@ mock==1.3.0
iniparse==0.4
PrettyTable>=0.7.1,<0.8 # BSD
six>=1.9.0 # MIT
-git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
-git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
-git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
+opnfv
+baro_tests
+snaps
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 000000000..ba137687d
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,15 @@
+[metadata]
+name = functest
+version = 5
+home-page = https://wiki.opnfv.org/display/functest
+
+[files]
+packages = functest
+scripts =
+ docker/docker_remote_api/enable_remote_api.sh
+ docker/add_images.sh
+ docker/config_install_env.sh
+
+[entry_points]
+console_scripts =
+ functest = functest.cli.cli_base:cli
diff --git a/setup.py b/setup.py
index 0c53ffbc9..460651cfd 100644
--- a/setup.py
+++ b/setup.py
@@ -1,25 +1,17 @@
-##############################################################################
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-from setuptools import setup, find_packages
+# pylint: disable=missing-docstring
+from setuptools import setup
setup(
- name="functest",
- version="master",
- py_modules=['cli_base'],
- packages=find_packages(),
- include_package_data=True,
- package_data={
- },
- url="https://www.opnfv.org",
- entry_points={
- 'console_scripts': [
- 'functest=functest.cli.cli_base:cli'
- ],
- },
+ setup_requires=['pbr>=1.9', 'setuptools>=17.1'],
+ pbr=True,
)
diff --git a/tox.ini b/tox.ini
index 12091c15a..c8d45457c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,9 @@ usedevelop = True
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
+ git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
+ git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
+ git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
commands = nosetests --with-xunit \
--with-coverage \
--cover-tests \
@@ -20,14 +23,10 @@ commands = sphinx-build -W -b html api/ api/_build
[testenv:pep8]
basepython = python2.7
-deps =
- {[testenv]deps}
commands = flake8
[testenv:pylint]
basepython = python2.7
-deps =
- {[testenv]deps}
whitelist_externals = bash
modules =
functest.core
@@ -47,7 +46,4 @@ dirs =
functest/tests/unit/core
functest/tests/unit/odl
functest/tests/unit/utils/test_decorators.py
-deps =
- -r{toxinidir}/requirements.py3.txt
- -r{toxinidir}/test-requirements.txt
commands = nosetests {[testenv:py35]dirs}