Merge "Add a simple baremetal functional job"

This commit is contained in:
Zuul 2018-07-31 15:01:38 +00:00 committed by Gerrit Code Review
commit 2b864f71ab
4 changed files with 164 additions and 16 deletions

View File

@ -40,10 +40,10 @@
- openstacksdk-tox-py35-tips
- job:
name: openstacksdk-functional-devstack-base
name: openstacksdk-functional-devstack-minimum
parent: devstack-tox-functional-consumer
description: |
Base job for devstack-based functional tests
Minimum job for devstack-based functional tests
post-run: playbooks/devstack/post.yaml
required-projects:
# These jobs will DTRT when openstacksdk triggers them, but we want to
@ -56,9 +56,32 @@
override-branch: master
- name: openstack/os-client-config
override-branch: master
timeout: 9000
vars:
devstack_localrc:
Q_ML2_PLUGIN_EXT_DRIVERS: qos,port_security
tox_environment:
# Do we really need to set this? It's cargo culted
PYTHONUNBUFFERED: 'true'
# Is there a way we can query the localconf variable to get these
# rather than setting them explicitly?
OPENSTACKSDK_HAS_DESIGNATE: 0
OPENSTACKSDK_HAS_HEAT: 0
OPENSTACKSDK_HAS_MAGNUM: 0
OPENSTACKSDK_HAS_NEUTRON: 1
OPENSTACKSDK_HAS_SWIFT: 1
tox_install_siblings: false
tox_envlist: functional
zuul_work_dir: src/git.openstack.org/openstack/openstacksdk
- job:
name: openstacksdk-functional-devstack-base
parent: openstacksdk-functional-devstack-minimum
description: |
Base job for devstack-based functional tests
required-projects:
- name: openstack/heat
- name: openstack/swift
timeout: 9000
vars:
devstack_local_conf:
post-config:
@ -73,18 +96,7 @@
devstack_plugins:
heat: https://git.openstack.org/openstack/heat
tox_environment:
# Do we really need to set this? It's cargo culted
PYTHONUNBUFFERED: 'true'
# Is there a way we can query the localconf variable to get these
# rather than setting them explicitly?
OPENSTACKSDK_HAS_DESIGNATE: 0
OPENSTACKSDK_HAS_HEAT: 1
OPENSTACKSDK_HAS_MAGNUM: 0
OPENSTACKSDK_HAS_NEUTRON: 1
OPENSTACKSDK_HAS_SWIFT: 1
tox_install_siblings: false
tox_envlist: functional
zuul_work_dir: src/git.openstack.org/openstack/openstacksdk
- job:
name: openstacksdk-functional-devstack-legacy
@ -112,7 +124,6 @@
- openstack/octavia
vars:
devstack_localrc:
Q_ML2_PLUGIN_EXT_DRIVERS: qos,port_security
DISABLE_AMP_IMAGE_BUILD: True
devstack_local_conf:
post-config:
@ -218,6 +229,54 @@
OPENSTACKSDK_HAS_SWIFT: 0
OPENSTACKSDK_HAS_SENLIN: 1
- job:
name: openstacksdk-functional-devstack-ironic
parent: openstacksdk-functional-devstack-minimum
description: |
Run openstacksdk functional tests against a master devstack with ironic
required-projects:
- openstack/ironic
vars:
devstack_localrc:
OVERRIDE_PUBLIC_BRIDGE_MTU: 1400
IRONIC_BAREMETAL_BASIC_OPS: True
IRONIC_BUILD_DEPLOY_RAMDISK: False
IRONIC_CALLBACK_TIMEOUT: 600
IRONIC_DEPLOY_DRIVER: ipmi
IRONIC_RAMDISK_TYPE: tinyipa
IRONIC_VM_COUNT: 6
IRONIC_VM_LOG_DIR: '{{ devstack_base_dir }}/ironic-bm-logs'
IRONIC_VM_SPECS_RAM: 384
devstack_plugins:
ironic: git://git.openstack.org/openstack/ironic
devstack_services:
c-api: False
c-bak: False
c-sch: False
c-vol: False
cinder: False
s-account: False
s-container: False
s-object: False
s-proxy: False
n-api: False
n-api-meta: False
n-cauth: False
n-cond: False
n-cpu: False
n-novnc: False
n-obj: False
n-sch: False
nova: False
placement-api: False
tox_environment:
OPENSTACKSDK_HAS_IRONIC: 1
# NOTE(dtantsur): this job cannot run many regular tests (e.g. compute
# tests will take too long), so limiting it to baremetal tests only.
OPENSTACKSDK_TESTS_SUBDIR: baremetal
zuul_copy_output:
'{{ devstack_base_dir }}/ironic-bm-logs': 'logs'
- job:
name: openstacksdk-ansible-functional-devstack
parent: openstacksdk-functional-devstack
@ -311,6 +370,8 @@
- openstacksdk-functional-devstack-senlin
- openstacksdk-functional-devstack-magnum:
voting: false
- openstacksdk-functional-devstack-ironic:
voting: false
- openstacksdk-functional-devstack-python3
- osc-functional-devstack-tips:
voting: false

View File

@ -0,0 +1,87 @@
# 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 openstack import exceptions
from openstack.tests.functional import base
class TestBareMetalNode(base.BaseFunctionalTest):
node_id = None
def setUp(self):
super(TestBareMetalNode, self).setUp()
self.require_service('baremetal')
def tearDown(self):
if self.node_id:
self.conn.baremetal.delete_node(self.node_id, ignore_missing=True)
super(TestBareMetalNode, self).tearDown()
def test_node_create_get_delete(self):
node = self.conn.baremetal.create_node(driver='fake-hardware',
name='node-name')
self.node_id = node.id
self.assertIsNotNone(self.node_id)
self.assertEqual(node.name, 'node-name')
self.assertEqual(node.driver, 'fake-hardware')
self.assertEqual(node.provision_state, 'available')
self.assertFalse(node.is_maintenance)
# NOTE(dtantsur): get_node and find_node only differ in handing missing
# nodes, otherwise they are identical.
for call, ident in [(self.conn.baremetal.get_node, self.node_id),
(self.conn.baremetal.get_node, 'node-name'),
(self.conn.baremetal.find_node, self.node_id),
(self.conn.baremetal.find_node, 'node-name')]:
found = call(ident)
self.assertEqual(node.id, found.id)
self.assertEqual(node.name, found.name)
nodes = self.conn.baremetal.nodes()
self.assertIn(node.id, [n.id for n in nodes])
self.conn.baremetal.delete_node(node, ignore_missing=False)
self.assertRaises(exceptions.NotFoundException,
self.conn.baremetal.get_node, self.node_id)
def test_node_create_in_enroll_provide(self):
node = self.conn.baremetal.create_node(driver='fake-hardware',
provision_state='enroll')
self.node_id = node.id
self.assertEqual(node.driver, 'fake-hardware')
self.assertEqual(node.provision_state, 'enroll')
self.assertIsNone(node.power_state)
self.assertFalse(node.is_maintenance)
self.conn.baremetal.set_node_provision_state(node, 'manage',
wait=True)
self.assertEqual(node.provision_state, 'manageable')
self.conn.baremetal.set_node_provision_state(node, 'provide',
wait=True)
self.assertEqual(node.provision_state, 'available')
def test_node_negative_non_existing(self):
uuid = "5c9dcd04-2073-49bc-9618-99ae634d8971"
self.assertRaises(exceptions.NotFoundException,
self.conn.baremetal.get_node, uuid)
self.assertRaises(exceptions.NotFoundException,
self.conn.baremetal.find_node, uuid,
ignore_missing=False)
self.assertRaises(exceptions.NotFoundException,
self.conn.baremetal.delete_node, uuid,
ignore_missing=False)
self.assertIsNone(self.conn.baremetal.find_node(uuid))
self.assertIsNone(self.conn.baremetal.delete_node(uuid))

View File

@ -32,7 +32,7 @@ basepython = {env:OPENSTACKSDK_TOX_PYTHON:python2}
setenv =
{[testenv]setenv}
OS_TEST_TIMEOUT=90
commands = stestr --test-path ./openstack/tests/functional run --serial {posargs}
commands = stestr --test-path ./openstack/tests/functional/{env:OPENSTACKSDK_TESTS_SUBDIR:} run --serial {posargs}
stestr slowest
[testenv:pep8]