Improve test coverage of the fetch-zuul-cloner role and the shim
This tests that we are indeed able to use the zuul cloner shim and that it works as expected with and without required projects. Change-Id: I537ce7ff417558edb3260acb6424a4a2b54046e4
This commit is contained in:
parent
a80691a49c
commit
264a83e02f
@ -24,3 +24,61 @@
|
||||
- directory | succeeded
|
||||
- cloner.stat.exists
|
||||
- cloner.stat.mode == "0755"
|
||||
|
||||
- name: Zuul clone something in required-projects
|
||||
shell:
|
||||
executable: /bin/bash
|
||||
cmd: |
|
||||
CLONEMAP=`mktemp`
|
||||
function cleanup {
|
||||
rm -f $CLONEMAP
|
||||
}
|
||||
trap cleanup EXIT
|
||||
cat > $CLONEMAP << EOF
|
||||
clonemap:
|
||||
- name: openstack-infra/project-config
|
||||
dest: {{ ansible_user_dir }}
|
||||
EOF
|
||||
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP \
|
||||
--cache-dir /opt/git git://git.openstack.org \
|
||||
openstack-infra/project-config
|
||||
register: clone_with_required
|
||||
|
||||
- name: Check if repository was cloned
|
||||
stat:
|
||||
path: "{{ ansible_user_dir }}/src/git.openstack.org/openstack-infra/project-config"
|
||||
register: with_required_stat
|
||||
|
||||
- name: Zuul clone something not in required-projects
|
||||
shell:
|
||||
executable: /bin/bash
|
||||
cmd: |
|
||||
CLONEMAP=`mktemp`
|
||||
function cleanup {
|
||||
rm -f $CLONEMAP
|
||||
}
|
||||
trap cleanup EXIT
|
||||
cat > $CLONEMAP << EOF
|
||||
clonemap:
|
||||
- name: openstack-infra/jenkins-job-builder
|
||||
dest: {{ ansible_user_dir }}
|
||||
EOF
|
||||
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP \
|
||||
--cache-dir /opt/git git://git.openstack.org \
|
||||
openstack-infra/jenkins-job-builder
|
||||
ignore_errors: yes
|
||||
register: clone_without_required
|
||||
|
||||
- name: Check if repository was cloned
|
||||
stat:
|
||||
path: "{{ ansible_user_dir }}/src/git.openstack.org/opentack-infra/jenkins-job-builder"
|
||||
register: without_required_stat
|
||||
|
||||
- name: Validate zuul-cloner shim results
|
||||
assert:
|
||||
that:
|
||||
- clone_with_required | succeeded
|
||||
- clone_with_required | changed
|
||||
- with_required_stat.stat.exists
|
||||
- clone_without_required | failed
|
||||
- not without_required_stat.stat.exists
|
||||
|
Loading…
Reference in New Issue
Block a user