# Want to test PR's but baffled by git submodules

**URL:** <https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083>\
**Category:** Ansible Developer\
**Created:** [December 28, 2015, 7:31pm UTC](https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083 "2015-12-28T19:31:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_Razmus\_II](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@Jim\_Razmus\_II](https://forum.ansible.com/u/Jim_Razmus_II)\
**Post date:** [December 28, 2015, 7:31pm UTC](https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083/1 "2015-12-28T19:31:32Z")

</div>

I am attempting to test PR1401 on the ansible-modules-extras submodule. I’ve followed the directions at [http://docs.ansible.com/ansible/developing\_test\_pr.html](http://docs.ansible.com/ansible/developing_test_pr.html) and [https://help.github.com/articles/checking-out-pull-requests-locally/](https://help.github.com/articles/checking-out-pull-requests-locally/) with no success. I think it’s the submodule that is tripping me up. But I’m hoping for some guidance. I’m running git and ansible on mac os x. I be most grateful if someone could show me the correct incantation to get that PR on a branch for testing.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [December 28, 2015, 7:47pm UTC](https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083/2 "2015-12-28T19:47:16Z")

</div>

I do the following:

cd ansible/lib/ansible/modules/extras  
git fetch origin pull/\<pr number\>/head:test\_pr\_branch  
git checkout test\_pr\_branch

and now ansible will be 'seeing' the specific code, to reset just do

cd ..  
git submodule update

^ that will reset the submodules to the correct point for the current  
ansible checkout.

you could also just cherry-pick or merge the changes in case your  
tests involve more current versions of other modules also.

once in a while you might want to delete the extra pull branches or  
`git branch` takes up lots of screen

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 28, 2015, 7:47pm UTC](https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083/3 "2015-12-28T19:47:21Z")

</div>

I believe these are the steps you want to take, from start, to finish:

1. git clone [https://github.com/ansible/ansible.git](https://github.com/ansible/ansible.git)
2. cd ansible
3. git submodule init
4. git submodule update --recursive
5. cd lib/ansible/modules/extras
6. git fetch origin pull/1412/head:pr/1412
7. git checkout pr/1412  
[DO YOUR TESTING HERE]
8. cd /path/to/ansible/clone
9. git submodule update --recursive

I’m going to assume by PR 1401, you were referencing Issue 1401, which has a PR at 1412.

---

<div class="post-metadata">

**Author:** ![Jim\_Razmus\_II](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@Jim\_Razmus\_II](https://forum.ansible.com/u/Jim_Razmus_II)\
**Post date:** [December 28, 2015, 8:45pm UTC](https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083/4 "2015-12-28T20:45:14Z")

</div>

Thank you!

I screwed up step 6. Indeed, the PR is 1412 for Issue 1401. Somehow I failed to discern the difference and was attempting to pull the wrong numerical ID.

IMO, the ansible documentation topic, “Finding A Pull Request and Checking It Out On A Branch” would be better by including your steps than the ‘someuser’ and ‘featurebranchname’ semantics currently recommended.

I’m off to test.

Best regards,  
Jim

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [December 28, 2015, 10:34pm UTC](https://forum.ansible.com/t/want-to-test-prs-but-baffled-by-git-submodules/20083/5 "2015-12-28T22:34:54Z")

</div>

Thanks. I agree. I’ll work on this.
