Compare commits

...

17 Commits

Author SHA1 Message Date
Jenkins
e59a62ec3f Merge "Updated from global requirements" into stable/kilo 2016-05-23 18:59:24 +00:00
Jenkins
68fc2b3db1 Merge "Do not print 'Created' message when using non-table formatter" into stable/kilo 2016-05-17 07:10:54 +00:00
Jenkins
58d22de75d Merge "Remove 'u' displayed before subnetpool-list's prefixes" into stable/kilo 2016-05-16 15:54:36 +00:00
OpenStack Proposal Bot
f6dca22bc6 Updated from global requirements
Change-Id: Ia68f1fca95d131014c17dccd8541e96c5d6cd20f
2016-04-29 22:58:13 +00:00
shu-mutou
2e0d641a55 Delete python bytecode before every test run
Because python creates pyc|pyo files and __pycache__
directories during tox runs, certain changes in the tree,
like deletes of files, or switching branches, can create
spurious errors.

The target bytecodes for deletion are in normal directories,
but not in dot started directory.

Change-Id: Iee36c67d2e5e4d9e78b1b1b493030761e0f46e3c
Closes-Bug: #1368661
(cherry picked from commit 83d61566ce)
2016-03-24 08:44:33 +00:00
linwwu
98fa6fd1c8 Remove 'u' displayed before subnetpool-list's prefixes
There is useless 'u' in the showing of "neutron subnetpool-list",
Please check bug/1531418 for details.
Add formatter as subnet did in the code.

Change-Id: I4e1502c379032da240ad51cce8be8c1ca558ef15
Closes-Bug: #1531418
(cherry picked from commit 0903017103)
2016-03-24 08:44:20 +00:00
Akihiro Motoki
ce05ad751d Do not print 'Created' message when using non-table formatter
When using non-table formatter like JSON or YAML formatter,
users want to pass output result to some other program.
Printing 'Created' message breaks the data format
and non-table formatter makes useless.

Functional tests for non-table formatters is added
to avoid the same thing again.

Change-Id: Ieb38bd26d26d134d4d274ad2d9f4d1e79fa4e977
Closes-Bug: #1548897
(cherry picked from commit 150cc4ce56)
2016-03-24 08:44:04 +00:00
OpenStack Proposal Bot
831604f2ed Updated from global requirements
Change-Id: I2cea51484dd9a65b686e8def03466f3e94a05bd0
2016-03-10 17:15:10 +00:00
OpenStack Proposal Bot
6635aa40a9 Updated from global requirements
Change-Id: Ib342509632ad4cc10b3ab88cdb55880689105b9e
2015-11-17 23:17:49 +00:00
OpenStack Proposal Bot
4b414a9cbe Updated from global requirements
Change-Id: I2766893675e20829d37b63ea96bca062687baf30
2015-10-09 14:18:45 +00:00
Takashi NATSUME
9c34bd21cf Update path to subunit2html in post_test_hook
Per:

http://lists.openstack.org/pipermail/openstack-dev/2015-August/072982.html

The location of subunit2html changed on the images in the gate
so update the path used in the post_test_hook.

Long-term we should just use what's in devstack-gate.

Closes-Bug: #1491646
(cherry picked from commit d75f79f67c)

This also adds a gate_hook to invoke d-g for env prepping. It merely
triggers main devstack-gate script. We need the hook because our new
neutronclient jobs define gate_hook function that points to it, and in
that case devstack-gate does NOT trigger its main script, leaving it up
to the hook.

Depends-on: I8549db52fa5b752202ac7f019b3e1931a697e337
Change-Id: If37743547f739e494501bbc5dc3bb214293919fa
2015-10-08 15:30:53 +02:00
OpenStack Proposal Bot
259d080d19 Updated from global requirements
Change-Id: Ic4a87fa628addcb66cd2a1e6c7557b8891a9e49a
2015-08-14 16:36:44 +00:00
OpenStack Proposal Bot
ca96a7cdc7 Updated from global requirements
Change-Id: I22264ccb83a3f612a4ea32cd81065f5bc31ba18f
2015-07-13 15:02:54 +00:00
LIU Yulong
73344e7c8a Add missing tenant_id to lbaas-v2 resources creation
Now tenant_id is not specific when creating lbaas v2 loadbalancer, listener,
pool, member. This patch add missing tenant_id to lbaas-v2 resources
creation. So admin user can create resource for specific project.

Change-Id: If4db4d8660354bc1f4d5259ebed73d78b4cfcd97
Closes-Bug: #1453706
(cherry picked from commit d5360202e1)
2015-06-24 03:01:20 +00:00
OpenStack Proposal Bot
cddc054359 Updated from global requirements
Change-Id: I2a115af9543d3943028df575aec0d2958b70914e
2015-06-16 13:58:06 +00:00
Adrien Vergé
c054d2583b Fix functional tests and tox 2.0 errors
With the recent update to tox 2.0.x, environment variables such as
OS_AUTH_URL are not passed by default, resulting in tests errors
mentionning Keystone authentication failures.

This patch reads credentials from the 'functional_creds.conf' config
file, like it is done in novaclient, glanceclient, manilaclient and
soon in cinderclient.

Reading credentials the old way (the environment) is still possible.

Conflicts:
	neutronclient/tests/functional/test_clientlib.py

Change-Id: Ief0f050044ecd90a14bbaf044e2b93ade0a6173f
Closes-Bug: #1455102
(cherry picked from commit 7eb3241650)
2015-06-12 17:29:41 +09:00
Doug Hellmann
dc62768c5b update defaultbranch
Change-Id: Ifa9dabde73fc88f8c78d853338353731db7f8b76
2015-04-15 13:29:14 +00:00
16 changed files with 174 additions and 37 deletions

View File

@@ -2,3 +2,5 @@
host=review.openstack.org
port=29418
project=openstack/python-neutronclient.git
defaultbranch=stable/kilo

View File

@@ -0,0 +1,8 @@
# Credentials for functional testing
[auth]
uri = http://10.42.0.50:5000/v2.0
[admin]
user = admin
tenant = admin
pass = secrete

View File

@@ -476,8 +476,9 @@ class CreateCommand(NeutronCommand, show.ShowOne):
self.format_output_data(data)
info = self.resource in data and data[self.resource] or None
if info:
print(_('Created a new %s:') % self.resource,
file=self.app.stdout)
if parsed_args.formatter == 'table':
print(_('Created a new %s:') % self.resource,
file=self.app.stdout)
else:
info = {'': ''}
return zip(*sorted(six.iteritems(info)))

View File

@@ -106,7 +106,8 @@ class CreateListener(neutronV20.CreateCommand):
['connection-limit', 'description',
'loadbalancer_id', 'name',
'default_tls_container_id',
'sni_container_ids'])
'sni_container_ids',
'tenant_id'])
return body

View File

@@ -73,7 +73,7 @@ class CreateLoadBalancer(neutronV20.CreateCommand):
}
neutronV20.update_dict(parsed_args, body[self.resource],
['description', 'provider', 'vip_address',
'name'])
'tenant_id', 'name'])
return body

View File

@@ -101,7 +101,7 @@ class CreateMember(neutronV20.CreateCommand):
},
}
neutronV20.update_dict(parsed_args, body[self.resource],
['weight', 'subnet_id'])
['weight', 'subnet_id', 'tenant_id'])
return body

View File

@@ -100,7 +100,7 @@ class CreatePool(neutronV20.CreateCommand):
}
neutronV20.update_dict(parsed_args, body[self.resource],
['description', 'name',
'session_persistence'])
'session_persistence', 'tenant_id'])
return body

View File

@@ -18,6 +18,13 @@ from neutronclient.i18n import _
from neutronclient.neutron import v2_0 as neutronV20
def _format_prefixes(subnetpool):
try:
return '\n'.join(pool for pool in subnetpool['prefixes'])
except (TypeError, KeyError):
return subnetpool['prefixes']
def add_updatable_arguments(parser):
parser.add_argument(
'--min-prefixlen', type=int,
@@ -43,6 +50,7 @@ def updatable_args2body(parsed_args, body, for_create=True):
class ListSubnetPool(neutronV20.ListCommand):
"""List subnetpools that belong to a given tenant."""
_formatters = {'prefixes': _format_prefixes, }
resource = 'subnetpool'
list_columns = ['id', 'name', 'prefixes',
'default_prefixlen']

View File

@@ -12,9 +12,44 @@
import os
from six.moves import configparser
from tempest_lib.cli import base
_CREDS_FILE = 'functional_creds.conf'
def credentials():
"""Retrieves credentials to run functional tests
Credentials are either read from the environment or from a config file
('functional_creds.conf'). Environment variables override those from the
config file.
The 'functional_creds.conf' file is the clean and new way to use (by
default tox 2.0 does not pass environment variables).
"""
username = os.environ.get('OS_USERNAME')
password = os.environ.get('OS_PASSWORD')
tenant_name = os.environ.get('OS_TENANT_NAME')
auth_url = os.environ.get('OS_AUTH_URL')
config = configparser.RawConfigParser()
if config.read(_CREDS_FILE):
username = username or config.get('admin', 'user')
password = password or config.get('admin', 'pass')
tenant_name = tenant_name or config.get('admin', 'tenant')
auth_url = auth_url or config.get('auth', 'uri')
return {
'username': username,
'password': password,
'tenant_name': tenant_name,
'auth_url': auth_url
}
class ClientTestBase(base.ClientTestBase):
"""This is a first pass at a simple read only python-neutronclient test.
This only exercises client commands that are read only.
@@ -28,16 +63,15 @@ class ClientTestBase(base.ClientTestBase):
"""
def _get_clients(self):
creds = credentials()
cli_dir = os.environ.get(
'OS_NEUTRONCLIENT_EXEC_DIR',
os.path.join(os.path.abspath('.'), '.tox/functional/bin'))
return base.CLIClient(
username=os.environ.get('OS_USERNAME'),
password=os.environ.get('OS_PASSWORD'),
tenant_name=os.environ.get('OS_TENANT_NAME'),
uri=os.environ.get('OS_AUTH_URL'),
cli_dir=cli_dir)
return base.CLIClient(username=creds['username'],
password=creds['password'],
tenant_name=creds['tenant_name'],
uri=creds['auth_url'],
cli_dir=cli_dir)
def neutron(self, *args, **kwargs):
return self.clients.neutron(*args,

View File

@@ -0,0 +1,59 @@
# Copyright 2016 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
import yaml
from neutronclient.tests.functional import base
class TestCLIFormatter(base.ClientTestBase):
def setUp(self):
super(TestCLIFormatter, self).setUp()
self.net_name = 'net-%s' % uuidutils.generate_uuid()
self.addCleanup(self.neutron, 'net-delete %s' % self.net_name)
def _create_net(self, fmt, col_attrs):
params = ['-c %s' % attr for attr in col_attrs]
params.append('-f %s' % fmt)
params.append(self.net_name)
param_string = ' '.join(params)
return self.neutron('net-create', params=param_string)
def test_net_create_with_json_formatter(self):
result = self._create_net('json', ['name', 'admin_state_up'])
self.assertDictEqual({'name': self.net_name,
'admin_state_up': True},
jsonutils.loads(result))
def test_net_create_with_yaml_formatter(self):
result = self._create_net('yaml', ['name', 'admin_state_up'])
self.assertDictEqual({'name': self.net_name,
'admin_state_up': True},
yaml.load(result))
def test_net_create_with_value_formatter(self):
# NOTE(amotoki): In 'value' formatter, there is no guarantee
# in the order of attribute, so we use one attribute in this test.
result = self._create_net('value', ['name'])
self.assertEqual(self.net_name, result.strip())
def test_net_create_with_shell_formatter(self):
result = self._create_net('shell', ['name', 'admin_state_up'])
result_lines = set(result.strip().split('\n'))
self.assertSetEqual(set(['name="%s"' % self.net_name,
'admin_state_up="True"']),
result_lines)

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -ex
$BASE/new/devstack-gate/devstack-vm-gate.sh

View File

@@ -18,7 +18,7 @@ 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/python /usr/local/jenkins/slave_scripts/subunit2html.py $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
sudo /usr/os-testr-env/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
@@ -28,15 +28,28 @@ function generate_testr_results {
export NEUTRONCLIENT_DIR="$BASE/new/python-neutronclient"
sudo chown -R jenkins:stack $NEUTRONCLIENT_DIR
# Get admin credentials
cd $BASE/new/devstack
source openrc admin admin
# Store these credentials into the config file
CREDS_FILE=$NEUTRONCLIENT_DIR/functional_creds.conf
cat <<EOF > $CREDS_FILE
# Credentials for functional testing
[auth]
uri = $OS_AUTH_URL
[admin]
user = $OS_USERNAME
tenant = $OS_TENANT_NAME
pass = $OS_PASSWORD
EOF
# Go to the neutronclient dir
cd $NEUTRONCLIENT_DIR
sudo chown -R jenkins:stack $NEUTRONCLIENT_DIR
# Run tests
echo "Running neutronclient functional test suite"
set +e

View File

@@ -1,16 +1,16 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=0.6,!=0.7,<1.0
pbr!=0.7,<1.0,>=0.6
argparse
cliff>=1.10.0,<1.11.0 # Apache-2.0
cliff<1.11.0,>=1.10.0 # Apache-2.0
iso8601>=0.1.9
netaddr>=0.7.12
oslo.i18n>=1.5.0,<1.6.0 # Apache-2.0
oslo.serialization>=1.4.0,<1.5.0 # Apache-2.0
oslo.utils>=1.4.0,<1.5.0 # Apache-2.0
requests>=2.2.0,!=2.4.0
python-keystoneclient>=1.1.0
oslo.i18n<1.6.0,>=1.5.0 # Apache-2.0
oslo.serialization<1.5.0,>=1.4.0 # Apache-2.0
oslo.utils!=1.4.1,<1.5.0,>=1.4.0 # Apache-2.0
requests!=2.4.0,<2.8.0,>=2.2.0
python-keystoneclient<1.4.0,>=1.2.0
simplejson>=2.2.0
six>=1.9.0
Babel>=1.3
Babel!=2.3.0,!=2.3.1,!=2.3.2,!=2.3.3,>=1.3 # BSD

View File

@@ -1,4 +1,3 @@
#!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");

View File

@@ -1,19 +1,19 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=0.10.0,<0.11
hacking<0.11,>=0.10.0
cliff-tablib>=1.0
cliff-tablib<2.0,>=1.0
coverage>=3.6
discover
fixtures>=0.3.14
mox3>=0.7.0
mock>=1.0
oslosphinx>=2.5.0,<2.6.0 # Apache-2.0
oslotest>=1.5.1,<1.6.0 # Apache-2.0
fixtures<1.3.0,>=0.3.14
mox3<0.8.0,>=0.7.0
mock<1.1.0,>=1.0
oslosphinx<2.6.0,>=2.5.0 # Apache-2.0
oslotest<1.6.0,>=1.5.1 # Apache-2.0
python-subunit>=0.0.18
requests-mock>=0.6.0 # Apache-2.0
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
requests-mock>=0.6.0 # Apache-2.0
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
testrepository>=0.0.18
testtools>=0.9.36,!=1.2.0
tempest-lib>=0.4.0
testtools!=1.2.0,<2.0.0,>=0.9.36
tempest-lib<0.5.0,>=0.4.0

View File

@@ -13,7 +13,14 @@ usedevelop = True
install_command = pip install -U {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py testr --testr-args='{posargs}'
# Delete bytecodes from normal directories before running tests.
# Note that bytecodes in dot directories will not be deleted
# to keep bytecodes of python modules installed into virtualenvs.
commands = sh -c "find . -type d -name '.?*' -prune -o \
\( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \
-print0 | xargs -0 rm -rf"
python setup.py testr --testr-args='{posargs}'
whitelist_externals = sh
[testenv:pep8]
commands = flake8