-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve tests capabilities by using local/fake remote repositories #202
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks very good to me, but I would like to see a review from one of the three requested as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't read through all tests in detail and mainly focused on the Ruby code. Overall I think this is a very good change. The test suite certainly deserved some love.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge thanks for this. It looks really good! Some minor nitpicks on the English grammar.
91e1af3
to
dc88b18
Compare
@ekohl , @raphink and @alexjfisher Its now ready for a new review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly 👍 but in particular the test needs to change if I read it correct.
dc88b18
to
2e2e306
Compare
This commit provides a new helper class Faker::PuppetModuleRemoteRepo to ease the write of tests when tested operations should (or not) operate on the git repository of a puppet module. This class provides following features: - Fake a remote repository by creating a bare initialization usable using a local remote url (ie. file://) - Create basic operations behind the scene using a temporary repo (e.g. write, add and push a file; read a file from a specified branch) - Populate the fake remote repo using a basic metadata.json - Simulate a read-only repo - Change the default branch - Count commits between two commit refs - Count commits made by an author on all the repo, or a specified branch Note: All operations are made using "Faker <faker@example.com>" as author and committer. This commit comes with a tiny Faker module to hold the config (ie. the working directory)
This commit changes to global git config used by Aruba during behavior tests in order to make tests more readable when counting commits made by an author
…po faker This commit replaces the use of dummy remote repo hosted on GitHub (ie. puppet-test from maestrodev) by fake repos provided by Faker::PuppetModuleRemoteRepo. Additonally, this commit adds expectations to ensure the remote is, or not depending the test, altered by the running test.
As msync as a default git_base set to GitHub, we need to be sure that there is no online repo usage anymore. To do so, we choose an invalid namespace/repo couple that ensure we operate on local (fake) repos.
This commit adds a "basic setup" step in order to reduce scenario verbosity and help to focus on important steps
2e2e306
to
563deb3
Compare
@ekohl All requested changes have been pushed. This PR is ready to be (re-)reviewed. |
Thanks @neomilium! I know I was a bit slow to review, but I do appreciate the cleanup. |
During the writing of #199 , I needed to refactor some code and would like to be bug-free so I relied on tests.
Behavior tests were pretty rich but lack of capabilities to test repository alteration (ie. commits made by
msync
).I started to work in this when I realized they used online repos where we can not push on then test operations.
Some tests were using a local clone of them to operate effectively on it, but still relies on online dummy repos.
This PR provides a new way to test
msync
operations by faking remote repositories.It relies on a new class to fake a remote repository of a puppet module.
This class
Faker::PuppetModuleRemoteRepo
(sorry for the long name), provides some features that helps to testModuleSync
behavior:bump
)Using this, we can now ensure that
msync
, for example, create a commit or not, depending on excepted behavior.This PR includes these new expectations on existing tests.
As side effect, all tests are now offline which allow to run them faster, specially when connectivity with GitHub is slow.
For the record, ATM, behind a pretty good connection tests passed in 1m11.826s (using current
master
branch), while they now run in 0m42.832s (reported bycucumber
).Additionally, this PR replaces
cat
usage byaruba
file matcher, reduces the verbosity of tests to create a basic setup with one puppet module and finally silent downcucumber
which promote its online service.@reviews I tried to split at most this PR with meaningful (I hope so) commit logs; I recommend to review each commit to keep a good track of changes.
Enjoy \o/