1# test code for the svn module 2# (c) 2014, Michael DeHaan <michael.dehaan@gmail.com> 3 4# This file is part of Ansible 5# 6# Ansible is free software: you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation, either version 3 of the License, or 9# (at your option) any later version. 10# 11# Ansible is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with Ansible. If not, see <http://www.gnu.org/licenses/>. 18 19# checks out every branch so using a small repo 20 21- name: initial checkout 22 subversion: 23 repo: '{{ subversion_repo_url }}' 24 dest: '{{ subversion_test_dir }}/svn' 25 register: subverted 26 27- name: check if dir was checked out 28 stat: 29 path: '{{ subversion_test_dir }}/svn' 30 register: subverted_result 31 32# FIXME: the before/after logic here should be fixed to make them hashes, see GitHub 6078 33# looks like this: { 34# "after": [ 35# "Revision: 9", 36# "URL: https://github.com/jimi-c/test_role" 37# ], 38# "before": null, 39# "changed": true, 40# "item": "" 41# } 42- name: verify information about the initial clone 43 assert: 44 that: 45 - "'after' in subverted" 46 - "subverted.after.1 == 'URL: ' ~ subversion_repo_url" 47 - "not subverted.before" 48 - "subverted.changed" 49 - subverted_result.stat.exists 50 51- name: repeated checkout 52 subversion: 53 repo: '{{ subversion_repo_url }}' 54 dest: '{{ subversion_test_dir }}/svn' 55 register: subverted2 56 57- name: verify on a reclone things are marked unchanged 58 assert: 59 that: 60 - "not subverted2.changed" 61 62- name: check for tags 63 stat: path={{ subversion_test_dir }}/svn/tags 64 register: tags 65 66- name: check for trunk 67 stat: path={{ subversion_test_dir }}/svn/trunk 68 register: trunk 69 70- name: check for branches 71 stat: path={{ subversion_test_dir }}/svn/branches 72 register: branches 73 74- name: assert presence of tags/trunk/branches 75 assert: 76 that: 77 - "tags.stat.isdir" 78 - "trunk.stat.isdir" 79 - "branches.stat.isdir" 80 81- name: remove checked out repo 82 file: 83 path: '{{ subversion_test_dir }}/svn' 84 state: absent 85 86- name: checkout with quotes in username 87 subversion: 88 repo: '{{ subversion_repo_auth_url }}' 89 dest: '{{ subversion_test_dir }}/svn' 90 username: '{{ subversion_username }}' 91 password: '{{ subversion_password }}' 92 register: subverted3 93 94- name: get result of checkout with quotes in username 95 stat: 96 path: '{{ subversion_test_dir }}/svn' 97 register: subverted3_result 98 99- name: assert checkout with quotes in username 100 assert: 101 that: 102 - subverted3 is changed 103 - subverted3_result.stat.exists 104 - subverted3_result.stat.isdir 105 106- name: checkout with export 107 subversion: 108 repo: '{{ subversion_repo_url }}' 109 dest: '{{ subversion_test_dir }}/svn-export' 110 export: True 111 register: subverted4 112 113- name: check for tags 114 stat: path={{ subversion_test_dir }}/svn-export/tags 115 register: export_tags 116 117- name: check for trunk 118 stat: path={{ subversion_test_dir }}/svn-export/trunk 119 register: export_trunk 120 121- name: check for branches 122 stat: path={{ subversion_test_dir }}/svn-export/branches 123 register: export_branches 124 125- name: assert presence of tags/trunk/branches in export 126 assert: 127 that: 128 - "export_tags.stat.isdir" 129 - "export_trunk.stat.isdir" 130 - "export_branches.stat.isdir" 131 - "subverted4.changed" 132 133# TBA: test for additional options or URL variants welcome 134