Skip to content

Commit d2063d8

Browse files
author
Zhuli
authored
Merge pull request theopenlab#33 from theopenlab/enable-lbaas
Support separate LBaaS tests for terraform-openstack-provider
2 parents 4691d11 + bde8d83 commit d2063d8

File tree

3 files changed

+75
-0
lines changed
  • playbooks/terraform-provider-openstack-acceptance-test-lbaas
  • roles/create-devstack-local-conf/tasks
  • zuul.d

3 files changed

+75
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
- hosts: all
2+
become: yes
3+
roles:
4+
- clone-devstack-gate-to-workspace
5+
- role: create-devstack-local-conf
6+
enable_services:
7+
- 'lbaas'
8+
- install-devstack
9+
tasks:
10+
- shell:
11+
cmd: |
12+
set -e
13+
set -o pipefail
14+
set -x
15+
16+
# Prep the testing environment by creating the required testing resources and environment variables
17+
pushd /opt/stack/new/devstack
18+
source openrc admin admin
19+
openstack flavor create m1.acctest --id 99 --ram 512 --disk 5 --vcpu 1 --ephemeral 10
20+
openstack flavor create m1.resize --id 98 --ram 512 --disk 6 --vcpu 1 --ephemeral 10
21+
_NETWORK_ID=$(openstack network show private -c id -f value)
22+
_EXTGW_ID=$(openstack network show public -c id -f value)
23+
_IMAGE=$(openstack image list | grep -i cirros | head -n 1)
24+
_IMAGE_ID=$(echo $_IMAGE | awk -F\| '{print $2}' | tr -d ' ')
25+
_IMAGE_NAME=$(echo $_IMAGE | awk -F\| '{print $3}' | tr -d ' ')
26+
echo export OS_IMAGE_NAME="$_IMAGE_NAME" >> openrc
27+
echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
28+
echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
29+
echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc
30+
echo export OS_POOL_NAME="public" >> openrc
31+
echo export OS_FLAVOR_ID=99 >> openrc
32+
echo export OS_FLAVOR_ID_RESIZE=98 >> openrc
33+
echo export OS_SHARE_NETWORK_ID=foobar >> openrc
34+
source openrc demo demo
35+
popd
36+
37+
# Run acc test
38+
if [[ ! -d $GOPATH/src/github.com/terraform-providers/terraform-provider-openstack/ && -d $GOPATH/src/github.com/theopenlab/terraform-provider-openstack ]]; then
39+
echo "Warning: this is a temporary workaround because this job is not triggered from official git repo."
40+
mkdir -p $GOPATH/src/github.com/terraform-providers/
41+
cp -r $GOPATH/src/github.com/theopenlab/terraform-provider-openstack $GOPATH/src/github.com/terraform-providers/
42+
cd $GOPATH/src/github.com/terraform-providers/terraform-provider-openstack
43+
fi
44+
45+
# Run the LB test 100 testcases at a time
46+
export OS_LB_ENVIRONMENT=1 # for LBaaS tests
47+
testcases=`go test ./openstack/ -v -list 'Acc'`
48+
testcases=`echo "$testcases" | sed '$d' | grep LB`
49+
echo "$testcases" | xargs -t -n100 sh -c 'TF_LOG=DEBUG TF_ACC=1 go test ./openstack -v -timeout 120m -run $(echo "$@" | tr " " "|")' argv0 2>&1 | tee $TEST_RESULTS_TXT
50+
executable: /bin/bash
51+
chdir: '{{ zuul.project.src_dir }}'
52+
environment: '{{ golang_env }}'

roles/create-devstack-local-conf/tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,19 @@
8080
environment: '{{ zuul | zuul_legacy_vars }}'
8181
when:
8282
- '"designate" in enable_services'
83+
84+
- name: create devstack local conf with lbaas enabled
85+
shell:
86+
cmd: |
87+
set -e
88+
set -x
89+
cat << EOF >> /tmp/dg-local.conf
90+
enable_service octavia,o-cw,o-hm,o-hk,o-api
91+
enable_plugin octavia https://git.openstack.org/openstack/octavia
92+
enable_plugin barbican https://git.openstack.org/openstack/barbican
93+
EOF
94+
executable: /bin/bash
95+
chdir: '{{ ansible_user_dir }}/workspace'
96+
environment: '{{ zuul | zuul_legacy_vars }}'
97+
when:
98+
- '"lbaas" in enable_services'

zuul.d/jobs.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@
146146
Run terraform-provider-openstack trove acceptance test on master branch
147147
run: playbooks/terraform-provider-openstack-acceptance-test-trove/run.yaml
148148

149+
- job:
150+
name: terraform-provider-openstack-acceptance-test-lbaas
151+
parent: golang-test
152+
description: |
153+
Run terraform provider openstack lbaas acceptance test on master branch
154+
run: playbooks/terraform-provider-openstack-acceptance-test-lbaas/run.yaml
155+
149156
# Gophercloud acceptance tests with Telefonica cloud
150157
- job:
151158
name: gophercloud-acceptance-test-telefonica

0 commit comments

Comments
 (0)