Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
5c9dc33e
Commit
5c9dc33e
authored
Mar 12, 2014
by
James Laska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional test_git scenarios
Includes coverage for accept_hostkey and additional scm URL formats.
parent
60a7f573
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
14 deletions
+71
-14
test/integration/roles/test_git/tasks/main.yml
+71
-14
No files found.
test/integration/roles/test_git/tasks/main.yml
View file @
5c9dc33e
...
...
@@ -16,11 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
name
:
set where to extract the repo
set_fact
:
checkout_dir={{ output_dir }}/git
-
name
:
set what repo to use
set_fact
:
repo=https://github.com/jimi-c/test_role
-
name
:
set role facts
set_fact
:
checkout_dir
:
'
{{
output_dir
}}/git'
repo_format1
:
'
https://github.com/jimi-c/test_role'
repo_format2
:
'
git@github.com:jimi-c/test_role.git'
repo_format3
:
'
ssh://git@github.com/jimi-c/test_role.git'
known_host_files
:
-
"
{{
lookup('env','HOME')
}}/.ssh/known_hosts"
-
'
/etc/ssh/ssh_known_hosts'
-
name
:
clean out the output_dir
shell
:
rm -rf {{ output_dir }}/*
...
...
@@ -28,28 +32,26 @@
-
name
:
verify that git is installed so this test can continue
shell
:
which git
#
# Test repo=https://github.com/...
#
-
name
:
initial checkout
git
:
repo={{ repo }} dest={{ checkout_dir }}
git
:
repo={{ repo
_format1
}} dest={{ checkout_dir }}
register
:
git_result
-
debug
:
var=git_result
-
shell
:
ls ~/ansible_testing/git
-
name
:
verify information about the initial clone
assert
:
that
:
-
"
'before'
in
git_result"
-
"
'after'
in
git_result"
-
"
not
git_result.before"
-
"
git_result.changed"
-
"
git_result.changed"
-
name
:
repeated checkout
git
:
repo={{ repo }} dest={{ checkout_dir }}
git
:
repo={{ repo
_format1
}} dest={{ checkout_dir }}
register
:
git_result2
-
debug
:
var=git_result2
-
name
:
check for tags
stat
:
path={{ checkout_dir }}/.git/refs/tags
register
:
tags
...
...
@@ -74,6 +76,61 @@
that
:
-
"
not
git_result2.changed"
#
# Test repo=git@github.com:/...
# Requires variable: github_ssh_private_key
#
-
name
:
clear checkout_dir
file
:
state=absent path={{ checkout_dir }}
-
name
:
remove known_host files
file
:
state=absent path={{ item }}
with_items
:
known_host_files
-
name
:
checkout ssh://git@github.com repo without accept_hostkey (expected fail)
git
:
repo={{ repo_format2 }} dest={{ checkout_dir }}
register
:
git_result
ignore_errors
:
true
-
assert
:
that
:
-
'
git_result.failed'
-
'
git_result.msg
==
"github.com
has
an
unknown
hostkey.
Set
accept_hostkey
to
True
or
manually
add
the
hostkey
prior
to
running
the
git
module"'
-
name
:
checkout git@github.com repo with accept_hostkey (expected pass)
git
:
repo
:
'
{{
repo_format2
}}'
dest
:
'
{{
checkout_dir
}}'
accept_hostkey
:
true
key_file
:
'
{{
github_ssh_private_key
}}'
register
:
git_result
when
:
github_ssh_private_key is defined
-
assert
:
that
:
-
'
git_result.changed'
when
:
not git_result|skipped
#
# Test repo=ssh://git@github.com/...
# Requires variable: github_ssh_private_key
#
-
name
:
clear checkout_dir
file
:
state=absent path={{ checkout_dir }}
-
name
:
checkout ssh://git@github.com repo with accept_hostkey (expected pass)
git
:
repo
:
'
{{
repo_format3
}}'
dest
:
'
{{
checkout_dir
}}'
version
:
'
master'
accept_hostkey
:
false
# should already have been accepted
key_file
:
'
{{
github_ssh_private_key
}}'
register
:
git_result
when
:
github_ssh_private_key is defined
-
assert
:
that
:
-
'
git_result.changed'
when
:
not git_result|skipped
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment