-
-
Notifications
You must be signed in to change notification settings - Fork 54
Improve tests capabilities by using local/fake remote repositories #202
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b9b6f8
Tests: Implement a Puppet module remote repository faker
neomilium 93b3f9e
Cucumber: Setup the use of the ModuleSync::Faker module
neomilium 466d3ac
Tests: Provide new steps to use PuppetModuleRemoteRepo faker
neomilium 458319f
Tests: Set git identity to "Aruba <aruba@example.com"
neomilium 7cdaeb3
Tests: Improve behavior tests scenarios by using PuppetModuleRemoteRe…
neomilium 8bfbad5
Tests: Remove unused steps
neomilium 575781f
Tests: Rename maestrodev namespace to fakenamespace
neomilium 34aaf91
Tests: Replace cat usage by aruba file matcher
neomilium ded9f08
Tests: Provide a step to setup a msync with one puppet module
neomilium 563deb3
Cucumber: Silent message about publishing results
neomilium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| default: --publish-quiet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,75 @@ | ||
| Given 'a mocked git configuration' do | ||
| steps %( | ||
| Given a mocked home directory | ||
| And I run `git config --global user.name Test` | ||
| And I run `git config --global user.email test@example.com` | ||
| ) | ||
| end | ||
| require_relative '../../spec/helpers/faker/puppet_module_remote_repo' | ||
|
|
||
| Given 'a remote module repository' do | ||
| Given 'a basic setup with a puppet module {string} from {string}' do |name, namespace| | ||
| steps %( | ||
| Given a directory named "sources" | ||
| And I run `git clone https://github.com/maestrodev/puppet-test sources/puppet-test` | ||
| Given a mocked git configuration | ||
| And a puppet module "#{name}" from "#{namespace}" | ||
| And a file named "managed_modules.yml" with: | ||
| """ | ||
| --- | ||
| - puppet-test | ||
| - #{name} | ||
| """ | ||
| And a file named "modulesync.yml" with: | ||
| """ | ||
| --- | ||
| namespace: #{namespace} | ||
| """ | ||
| And a git_base option appended to "modulesync.yml" for local tests | ||
| ) | ||
| write_file('modulesync.yml', <<~CONFIG) | ||
| --- | ||
| namespace: sources | ||
| git_base: file://#{expand_path('.')}/ | ||
| CONFIG | ||
| end | ||
|
|
||
| Given Regexp.new(/a remote module repository with "(.+?)" as the default branch/) do |branch| | ||
| Given 'a mocked git configuration' do | ||
| steps %( | ||
| Given a directory named "sources" | ||
| And I run `git clone --mirror https://github.com/maestrodev/puppet-test sources/puppet-test` | ||
| And a file named "managed_modules.yml" with: | ||
| """ | ||
| --- | ||
| - puppet-test | ||
| """ | ||
| Given a mocked home directory | ||
| And I run `git config --global user.name Aruba` | ||
| And I run `git config --global user.email aruba@example.com` | ||
| ) | ||
| write_file('modulesync.yml', <<~CONFIG) | ||
| --- | ||
| namespace: sources | ||
| git_base: file://#{expand_path('.')}/ | ||
| CONFIG | ||
|
|
||
| cd('sources/puppet-test') do | ||
| steps %( | ||
| And I run `git branch -M master #{branch}` | ||
| And I run `git symbolic-ref HEAD refs/heads/#{branch}` | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| Given 'a puppet module {string} from {string}' do |name, namespace| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| pmrr.populate | ||
| end | ||
|
|
||
| Given 'a git_base option appended to "modulesync.yml" for local tests' do | ||
| File.write "#{Aruba.config.working_directory}/modulesync.yml", "\ngit_base: #{ModuleSync::Faker::PuppetModuleRemoteRepo.git_base}", mode: 'a' | ||
| end | ||
|
|
||
| Given 'the puppet module {string} from {string} is read-only' do |name, namespace| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| pmrr.read_only = true | ||
| end | ||
|
|
||
| Then 'the puppet module {string} from {string} should have no commits between {string} and {string}' do |name, namespace, commit1, commit2| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| expect(pmrr.commit_count_between(commit1, commit2)).to eq 0 | ||
| end | ||
|
|
||
| Then 'the puppet module {string} from {string} should have( only) {int} commit(s) made by {string}' do |name, namespace, commit_count, author| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| expect(pmrr.commit_count_by(author)).to eq commit_count | ||
| end | ||
|
|
||
| Then 'the puppet module {string} from {string} should have( only) {int} commit(s) made by {string} in branch {string}' do |name, namespace, commit_count, author, branch| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| expect(pmrr.commit_count_by(author, branch)).to eq commit_count | ||
| end | ||
|
|
||
| Then 'the puppet module {string} from {string} should have no commits made by {string}' do |name, namespace, author| | ||
| step "the puppet module \"#{name}\" from \"#{namespace}\" should have 0 commits made by \"#{author}\"" | ||
| end | ||
|
|
||
| Given 'the puppet module {string} from {string} has a file named {string} with:' do |name, namespace, filename, content| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| pmrr.add_file(filename, content) | ||
| end | ||
|
|
||
| Then 'the puppet module {string} from {string} should have a branch {string} with a file named {string} which contains:' do |name, namespace, branch, filename, content| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| expect(pmrr.read_file(filename, branch)).to include(content) | ||
| end | ||
|
|
||
| Given 'the puppet module {string} from {string} has the default branch named {string}' do |name, namespace, default_branch| | ||
| pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) | ||
| pmrr.default_branch = default_branch | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| require 'aruba/cucumber' | ||
|
|
||
| require_relative '../../spec/helpers/faker' | ||
|
|
||
| ModuleSync::Faker.working_directory = File.expand_path('faker', Aruba.config.working_directory) | ||
|
|
||
| Before do | ||
| @aruba_timeout_seconds = 5 | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.