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
82e8d677
Commit
82e8d677
authored
Oct 28, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test the git changes for the git module's recursive flag
parent
cb53b0f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
144 additions
and
1 deletions
+144
-1
lib/ansible/modules/core
+1
-1
test/integration/roles/test_git/tasks/main.yml
+143
-0
No files found.
core
@
63e81cfc
Subproject commit
9fe5c2af2dcfb125398475e4ed0b740e71d70709
Subproject commit
63e81cfc2e0c3c07245342cd41a0ba147eac55be
test/integration/roles/test_git/tasks/main.yml
View file @
82e8d677
...
...
@@ -22,6 +22,11 @@
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'
repo_submodules
:
'
https://github.com/abadger/test_submodules.git'
repo_submodules_newer
:
'
https://github.com/abadger/test_submodules_newer.git'
repo_submodule1
:
'
https://github.com/abadger/test_submodules_subm1.git'
repo_submodule1_newer
:
'
https://github.com/abadger/test_submodules_subm1_newer.git'
repo_submodule2
:
'
https://github.com/abadger/test_submodules_subm2.git'
known_host_files
:
-
"
{{
lookup('env','HOME')
}}/.ssh/known_hosts"
-
'
/etc/ssh/ssh_known_hosts'
...
...
@@ -147,3 +152,141 @@
-
assert
:
that
:
-
'
git_result.changed'
#
# Submodule tests
#
# Repository A with submodules defined (repo_submodules)
# .gitmodules file points to Repository I
# Repository B forked from A that has newer commits (repo_submodules_newer)
# .gitmodules file points to Repository II instead of I
# .gitmodules file also points to Repository III
# Repository I for submodule1 (repo_submodule1)
# Has 1 file checked in
# Repository II forked from I that has newer commits (repo_submodule1_newer)
# Has 2 files checked in
# Repository III for a second submodule (repo_submodule2)
# Has 1 file checked in
-
name
:
clear checkout_dir
file
:
state=absent path={{ checkout_dir }}
-
name
:
Test that clone without recursive does not retrieve submodules
git
:
repo
:
'
{{
repo_submodules
}}'
dest
:
'
{{
checkout_dir
}}'
recursive
:
no
-
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule1'
register
:
submodule1
-
assert
:
that
:
'
{{
submodule1.stdout_lines|length
}}
==
2'
-
name
:
clear checkout_dir
file
:
state=absent path={{ checkout_dir }}
-
name
:
Test that clone with recursive retrieves submodules
git
:
repo
:
'
{{
repo_submodules
}}'
dest
:
'
{{
checkout_dir
}}'
recursive
:
yes
-
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule1'
register
:
submodule1
-
assert
:
that
:
'
{{
submodule1.stdout_lines|length
}}
==
4'
-
name
:
Copy the checkout so we can run several different tests on it
command
:
'
cp
-pr
{{
checkout_dir
}}
{{
checkout_dir
}}.bak'
-
name
:
Check that modules will be updated if main repo is not
command
:
git config --replace-all remote.origin.url {{ repo_submodule1_newer }}
args
:
chdir
:
"
{{
checkout_dir
}}/submodule1"
-
git
:
repo
:
'
{{
repo_submodules
}}'
dest
:
'
{{
checkout_dir
}}'
update
:
yes
recursive
:
yes
track_submodules
:
yes
-
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule1'
register
:
submodule1
-
debug
:
var=submodule1
-
assert
:
that
:
'
{{
submodule1.stdout_lines|length
}}
==
5'
ignore_errors
:
true
-
name
:
Restore checkout to prior state
file
:
state=absent path={{ checkout_dir }}
-
command
:
'
cp
-pr
{{
checkout_dir
}}.bak
{{
checkout_dir
}}'
-
name
:
Test that update without recursive does not change submodules
command
:
'
git
config
--replace-all
remote.origin.url
{{
repo_submodules_newer
}}'
args
:
chdir
:
'
{{
checkout_dir
}}'
-
git
:
repo
:
'
{{
repo_submodules_newer
}}'
dest
:
'
{{
checkout_dir
}}'
recursive
:
no
update
:
yes
track_submodules
:
yes
-
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule1'
register
:
submodule1
-
stat
:
path
:
'
{{
checkout_dir
}}/submodule2'
register
:
submodule2
-
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule2'
register
:
submodule2
-
assert
:
that
:
'
{{
submodule1.stdout_lines|length
}}
==
4'
-
assert
:
that
:
'
{{
submodule2.stdout_lines|length
}}
==
2'
-
name
:
Restore checkout to prior state
file
:
state=absent path={{ checkout_dir }}
-
command
:
'
cp
-pr
{{
checkout_dir
}}.bak
{{
checkout_dir
}}'
-
name
:
Test that update with recursive updated existing submodules
command
:
'
git
config
--replace-all
remote.origin.url
{{
repo_submodules_newer
}}'
args
:
chdir
:
'
{{
checkout_dir
}}'
-
git
:
repo
:
'
{{
repo_submodules_newer
}}'
dest
:
'
{{
checkout_dir
}}'
update
:
yes
recursive
:
yes
track_submodules
:
yes
-
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule1'
register
:
submodule1
-
assert
:
that
:
'
{{
submodule1.stdout_lines|length
}}
==
5'
-
name
:
Test that update with recursive found new submodules
command
:
'
ls
-1a
{{
checkout_dir
}}/submodule2'
register
:
submodule2
-
assert
:
that
:
'
{{
submodule2.stdout_lines|length
}}
==
4'
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