Add a simple integration test

Change-Id: If6ba9601657bcd7996e9ef6ba65b369945215d19
This commit is contained in:
Dmitry Tantsur 2018-05-15 15:03:25 +02:00
parent 23d605c212
commit 92b968b68e
3 changed files with 207 additions and 0 deletions

105
.zuul.yaml Normal file
View File

@ -0,0 +1,105 @@
- job:
name: metalsmith-integration-base
description: |
Base job for devstack-based metalsmith jobs.
parent: devstack-minimal
pre-run: playbooks/integration/pre.yaml
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- ^metalsmith/test/.*$
- ^releasenotes/.*$
- ^setup.cfg$
- ^test-requirements.txt$
- ^tools/.*$
- ^tox.ini$
timeout: 3600
required-projects:
- openstack/keystone
- openstack/neutron
- openstack/glance
- openstack/ironic
- openstack/metalsmith
vars:
devstack_services:
dstat: true
etcd3: true
mysql: true
peakmem_tracker: true
rabbit: true
tls-proxy: true
# Keystone services
key: true
# Glance services
g-api: true
g-reg: true
# Nova services
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
placement-api: false
# Neutron services
q-agt: false
q-dhcp: false
q-l3: false
q-meta: false
q-metering: false
q-svc: false
neutron-api: true
neutron-agent: true
neutron-dhcp: true
neutron-l3: true
neutron-metadata-agent: true
neutron-metering: true
# Swift services
s-account: false
s-container: false
s-object: false
s-proxy: false
# Cinder services
c-api: false
c-bak: false
c-sch: false
c-vol: false
cinder: false
# Ceilometer services
ceilometer-acentral: False
ceilometer-acompute: False
ceilometer-alarm-evaluator: False
ceilometer-alarm-notifier: False
ceilometer-anotification: False
ceilometer-api: False
ceilometer-collector: False
# Services we don't need.
horizon: false
tempest: false
devstack_plugins:
ironic: https://git.openstack.org/openstack/ironic
devstack_localrc:
IRONIC_BAREMETAL_BASIC_OPS: true
IRONIC_BUILD_DEPLOY_RAMDISK: false
IRONIC_DEPLOY_DRIVER: ipmi
IRONIC_RAMDISK_TYPE: tinyipa
IRONIC_VM_COUNT: 1
IRONIC_VM_SPECS_DISK: 10
IRONIC_VM_SPECS_RAM: 384
- job:
name: metalsmith-integration-glance
description: |
Integration job using Glance as image source.
parent: metalsmith-integration-base
run: playbooks/integration/run.yaml
- project:
check:
jobs:
- metalsmith-integration-glance
gate:
jobs:
- metalsmith-integration-glance

View File

@ -0,0 +1,10 @@
- hosts: all
roles:
- run-devstack
tasks:
- name: Install metalsmith
pip:
name: /opt/stack/metalsmith
editable: true
become: true

View File

@ -0,0 +1,92 @@
- hosts: all
environment:
OS_CLOUD: devstack-admin
tasks:
- name: Find Cirros UEC image
shell: |
openstack image list -f value -c ID -c Name \
| awk '/cirros.*uec/ { print $1; exit 0; }'
register: cirros_image_result
- name: Check that Cirros UEC image was found
fail:
msg: No Cirros UEC image found
when: cirros_image_result.stdout == ""
- name: Find a suitable SSH public key
shell: |
for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
if [[ -r $i ]]; then
echo $i
break
fi
done
args:
executable: /bin/bash
register: ssh_key_result
- name: Check that an SSH key was found
fail:
msg: No SSH public key was found
when: ssh_key_result.stdout == ""
- name: Set deployment facts
set_fact:
cirros_image: "{{ cirros_image_result.stdout }}"
ssh_key_file: "{{ ssh_key_result.stdout }}"
- name: Deploy a node
shell: |
# FIXME(dtantsur): just use OS_CLOUD
source /opt/stack/devstack/openrc admin admin
metalsmith --debug deploy \
--network private \
--image {{ cirros_image }} \
--ssh-public-key {{ ssh_key_file }} \
--root-disk-size 9 \
--netboot \
baremetal
args:
executable: /bin/bash
environment:
# FIXME(dtantsur): just use OS_CLOUD
OS_USER_DOMAIN_NAME: Default
OS_PROJECT_DOMAIN_NAME: Default
- name: Find the deployed node
command: openstack baremetal node list --provision-state active -f value -c UUID
register: active_node_result
- name: Check that the deployed node was found
fail:
msg: The deployed node cannot be found
when: active_node_result.stdout == ""
- name: Set active node fact
set_fact:
active_node: "{{ active_node_result.stdout }}"
- name: Show active node information
command: openstack baremetal node show {{ active_node }}
- name: Undeploy a node
shell: |
# FIXME(dtantsur): just use OS_CLOUD
source /opt/stack/devstack/openrc admin admin
metalsmith --debug undeploy {{ active_node }}
args:
executable: /bin/bash
environment:
# FIXME(dtantsur): just use OS_CLOUD
OS_USER_DOMAIN_NAME: Default
OS_PROJECT_DOMAIN_NAME: Default
- name: Get the current status of the deployed node
command: openstack baremetal node show {{ active_node }} -f value -c provision_state
register: undeployed_node_result
- name: Check that the node was undeployed
fail:
msg: The node is in unexpected status {{ undeployed_node_result.stdout }}
when: undeployed_node_result.stdout != "available"