- hosts: all
environment:
OS_CLOUD: devstack-admin
tasks:
- name: Prepare flavor for tests
command: openstack flavor create test-flavor --ram 512 --disk 5 --vcpu 1 --public
- hosts: all
environment:
OS_CLOUD: devstack
RUST_BACKTRACE: 1
RUST_LOG: openstack,osauth,osproto,reqwest,hyper
tasks:
- name: Create an SSH key for testing
command: ssh-keygen -t rsa -N "" -f /tmp/test-key
- name: Find a Cirros image
shell: |
openstack image list -f value -c ID -c Name \
| awk '/cirros/ { print $1; exit 0; }'
register: cirros_image_result
failed_when: cirros_image_result.stdout == ""
- name: Build the project
command: cargo build --release --all-features
args:
chdir: '{{ project_dir }}'
- name: Run tests
command: cargo test -- --test-threads=1
args:
chdir: '{{ project_dir }}'
environment:
RUST_OPENSTACK_FLAVOR: test-flavor
RUST_OPENSTACK_NETWORK: private
RUST_OPENSTACK_IMAGE: "{{ cirros_image_result.stdout }}"
RUST_OPENSTACK_KEYPAIR: /tmp/test-key.pub
RUST_OPENSTACK_FLOATING_NETWORK: public
- name: Run examples
command: cargo run --example {{ item }}
args:
chdir: '{{ project_dir }}'
with_items:
- create-delete-port private private-subnet
- create-update-delete-router test-router
- create-router-with-external-gateway test-router public
- get-flavor test-flavor
- get-image {{ cirros_image_result.stdout }}
- get-network private
- list-floating-ips
- list-images
- list-keypairs
- list-networks
- list-ports
- list-routers
- list-servers
- list-subnets