From 9b9b6f83f675727527aeae7d9d68133dbf824db4 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:33:41 +0100 Subject: [PATCH 01/10] Tests: Implement a Puppet module remote repository faker 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 " as author and committer. This commit comes with a tiny Faker module to hold the config (ie. the working directory) --- spec/helpers/faker.rb | 14 ++ .../faker/puppet_module_remote_repo.rb | 140 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 spec/helpers/faker.rb create mode 100644 spec/helpers/faker/puppet_module_remote_repo.rb diff --git a/spec/helpers/faker.rb b/spec/helpers/faker.rb new file mode 100644 index 00000000..7ca66881 --- /dev/null +++ b/spec/helpers/faker.rb @@ -0,0 +1,14 @@ +module ModuleSync + # Faker is a top-level module to keep global faker config + module Faker + def self.working_directory=(path) + @working_directory = path + end + + def self.working_directory + raise 'Working directory must be set' if @working_directory.nil? + FileUtils.mkdir_p @working_directory + @working_directory + end + end +end diff --git a/spec/helpers/faker/puppet_module_remote_repo.rb b/spec/helpers/faker/puppet_module_remote_repo.rb new file mode 100644 index 00000000..07be9617 --- /dev/null +++ b/spec/helpers/faker/puppet_module_remote_repo.rb @@ -0,0 +1,140 @@ +require 'open3' + +require_relative '../faker' + +module ModuleSync + # Fake a remote git repository that holds a puppet module + # + # This module allows to fake a remote repositiory using: + # - a bare repo + # - a temporary cloned repo to operate on the remote before exposing to modulesync + # + # Note: This module needs to have working_directory sets before using it + module Faker + class PuppetModuleRemoteRepo + class CommandExecutionError < StandardError; end + + attr_reader :name, :namespace + + def initialize(name, namespace) + @name = name + @namespace = namespace + end + + def populate + FileUtils.chdir(Faker.working_directory) do + run %W[git init --bare #{bare_repo_dir}] + run %W[git clone #{bare_repo_dir} #{tmp_repo_dir}] + + module_short_name = name.split('-').last + + FileUtils.chdir(tmp_repo_dir) do + metadata = { + name: "modulesync-#{module_short_name}", + version: '0.4.2', + author: 'ModuleSync team', + } + + File.write 'metadata.json', metadata.to_json + run %w[git add metadata.json] + run %w[git commit --message] << 'Initial commit' + run %w[git push] + end + end + end + + def read_only=(value) + mode = value ? '0444' : '0644' + FileUtils.chdir(bare_repo_dir) do + run %W[git config core.sharedRepository #{mode}] + end + end + + def default_branch + FileUtils.chdir(bare_repo_dir) do + stdout = run %w[git symbolic-ref --short HEAD] + return stdout.chomp + end + end + + def default_branch=(value) + FileUtils.chdir(bare_repo_dir) do + run %W[git branch -M #{default_branch} #{value}] + run %W[git symbolic-ref HEAD refs/heads/#{value}] + end + end + + def read_file(filename, branch = nil) + branch ||= default_branch + FileUtils.chdir(bare_repo_dir) do + return run %W[git show #{branch}:#{filename}] + rescue CommandExecutionError + return nil + end + end + + def add_file(filename, content, branch = nil) + branch ||= default_branch + FileUtils.chdir(tmp_repo_dir) do + run %W[git checkout #{branch}] + File.write filename, content + run %W[git add #{filename}] + run %w[git commit --message] << "Add file: '#{filename}'" + run %w[git push] + end + end + + def commit_count_between(commit1, commit2) + FileUtils.chdir(bare_repo_dir) do + stdout = run %W[git rev-list --count #{commit1}..#{commit2}] + return Integer(stdout) + end + end + + def commit_count_by(author, commit = nil) + FileUtils.chdir(bare_repo_dir) do + commit ||= '--all' + stdout = run %W[git rev-list #{commit} --author #{author} --count] + return Integer(stdout) + end + end + + def remote_url + "file://#{bare_repo_dir}" + end + + def self.git_base + "file://#{Faker.working_directory}/bare/" + end + + private + + def tmp_repo_dir + File.join Faker.working_directory, 'tmp', namespace, name + end + + def bare_repo_dir + File.join Faker.working_directory, 'bare', namespace, "#{name}.git" + end + + GIT_ENV = { + 'GIT_AUTHOR_NAME' => 'Faker', + 'GIT_AUTHOR_EMAIL' => 'faker@example.com', + 'GIT_COMMITTER_NAME' => 'Faker', + 'GIT_COMMITTER_EMAIL' => 'faker@example.com', + }.freeze + + def run(command) + stdout, stderr, status = Open3.capture3(GIT_ENV, *command) + return stdout if status.success? + + warn "Command '#{command}' failed: #{status}" + warn ' STDOUT:' + warn stdout + warn ' STDERR:' + warn stderr + raise CommandExecutionError, "Command '#{command}' failed: #{status}" + end + end + end +end From 93b3f9e8aaf8432aa718caaeb1256522d53c5dcb Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:34:39 +0100 Subject: [PATCH 02/10] Cucumber: Setup the use of the ModuleSync::Faker module --- features/support/env.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/support/env.rb b/features/support/env.rb index f3f544d6..de44b9d4 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -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 From 466d3ac3597975224552d96540dbb13bdec0eca1 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:36:57 +0100 Subject: [PATCH 03/10] Tests: Provide new steps to use PuppetModuleRemoteRepo faker --- .rubocop.yml | 2 ++ features/step_definitions/git_steps.rb | 50 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 84fb5455..8c30206a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,6 +25,8 @@ Layout/IndentHeredoc: # sane line length Metrics/LineLength: Max: 120 + Exclude: + - 'features/**/*' Style/FrozenStringLiteralComment: Enabled: false diff --git a/features/step_definitions/git_steps.rb b/features/step_definitions/git_steps.rb index 36c1e903..bbc2e0ea 100644 --- a/features/step_definitions/git_steps.rb +++ b/features/step_definitions/git_steps.rb @@ -1,3 +1,5 @@ +require_relative '../../spec/helpers/faker/puppet_module_remote_repo' + Given 'a mocked git configuration' do steps %( Given a mocked home directory @@ -6,6 +8,54 @@ ) 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 + Given 'a remote module repository' do steps %( Given a directory named "sources" From 458319f0f223db6ff3510f09c8f540f12817a6fd Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:39:16 +0100 Subject: [PATCH 04/10] Tests: Set git identity to "Aruba Date: Sun, 20 Dec 2020 00:44:47 +0100 Subject: [PATCH 05/10] Tests: Improve behavior tests scenarios by using PuppetModuleRemoteRepo 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. --- features/cli.feature | 11 +- features/update.feature | 406 +++++++++++++++++++++++++++------------- 2 files changed, 282 insertions(+), 135 deletions(-) diff --git a/features/cli.feature b/features/cli.feature index 509ba47c..afa08699 100644 --- a/features/cli.feature +++ b/features/cli.feature @@ -18,7 +18,8 @@ Feature: CLI And the output should match /Commands:/ Scenario: When overriding a setting from the config file on the command line - Given a file named "managed_modules.yml" with: + Given a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -26,10 +27,10 @@ Feature: CLI And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: 'git@github.com:' + namespace: default """ + And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" - When I run `msync update --noop --git-base https://github.com/` + When I run `msync update --noop --namespace maestrodev` Then the exit status should be 0 - And the output should not match /git@github.com:/ + And the output should match /Syncing maestrodev/ diff --git a/features/update.feature b/features/update.feature index 5dedf977..5931f0b7 100644 --- a/features/update.feature +++ b/features/update.feature @@ -2,7 +2,9 @@ Feature: update ModuleSync needs to update module boilerplate Scenario: Adding a new file - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -10,9 +12,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -35,7 +37,10 @@ Feature: update Then the output should contain "aruba" Scenario: Using skip_broken option and adding a new file to repo without write access - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "faker" + And the puppet module "puppet-test" from "faker" is read-only + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -43,9 +48,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: 'git@github.com:' + namespace: faker """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -59,9 +64,13 @@ Feature: update """ When I run `msync update -s -m "Add test"` Then the exit status should be 0 + And the puppet module "puppet-test" from "faker" should have no commits made by "Aruba" Scenario: Adding a new file to repo without write access - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And the puppet module "puppet-test" from "maestrodev" is read-only + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -69,9 +78,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: 'git@github.com:' + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -85,9 +94,12 @@ Feature: update """ When I run `msync update -m "Add test" -r` Then the exit status should be 1 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Adding a new file, without the .erb suffix - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -95,9 +107,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -122,9 +134,12 @@ Feature: update """ Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Adding a new file using global values - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -132,9 +147,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -155,9 +170,12 @@ Feature: update """ Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Adding a new file overriding global values - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -165,9 +183,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -191,9 +209,12 @@ Feature: update """ Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Adding a new file ignoring global values - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -201,9 +222,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -227,9 +248,12 @@ Feature: update """ Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Adding a file that ERB can't parse - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -237,9 +261,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -255,9 +279,12 @@ Feature: update """ When I run `msync update --noop` Then the exit status should be 1 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Using skip_broken option with invalid files - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -265,9 +292,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -283,9 +310,12 @@ Feature: update """ When I run `msync update --noop -s` Then the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Using skip_broken and fail_on_warnings options with invalid files - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -293,9 +323,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -311,9 +341,16 @@ Feature: update """ When I run `msync update --noop --skip_broken --fail_on_warnings` Then the exit status should be 1 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Modifying an existing file - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And the puppet module "puppet-test" from "maestrodev" has a file named "Gemfile" with: + """ + source 'https://example.com' + """ + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -321,9 +358,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -347,10 +384,26 @@ Feature: update """ source 'https://somehost.com' """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Modifying an existing file and committing the change Given a mocked git configuration - And a remote module repository + And a puppet module "puppet-test" from "maestrodev" + And the puppet module "puppet-test" from "maestrodev" has a file named "Gemfile" with: + """ + source 'https://example.com' + """ + And a file named "managed_modules.yml" with: + """ + --- + - puppet-test + """ + And a file named "modulesync.yml" with: + """ + --- + namespace: maestrodev + """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -364,15 +417,21 @@ Feature: update """ When I run `msync update -m "Update Gemfile" -r test` Then the exit status should be 0 - Given I cd to "sources/puppet-test" - And I run `git checkout test` - Then the file "Gemfile" should contain: + And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "test" + And the puppet module "puppet-test" from "maestrodev" should have a branch "test" with a file named "Gemfile" which contains: """ source 'https://somehost.com' """ Scenario: Setting an existing file to unmanaged - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And the puppet module "puppet-test" from "maestrodev" has a file named "Gemfile" with: + """ + source 'https://rubygems.org' + """ + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -380,14 +439,15 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- Gemfile: unmanaged: true + gem_source: https://somehost.com """ And a directory named "moduleroot" And a file named "moduleroot/Gemfile.erb" with: @@ -410,9 +470,12 @@ Feature: update """ source 'https://rubygems.org' """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Setting an existing file to deleted - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -420,9 +483,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -434,6 +497,10 @@ Feature: update """ source '<%= @configs['gem_source'] %>' """ + And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: + """ + source 'https://rubygems.org' + """ When I run `msync update --noop` Then the output should match: """ @@ -442,9 +509,12 @@ Feature: update deleted file mode 100644 """ And the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Setting a non-existent file to deleted - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -452,9 +522,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -464,19 +534,22 @@ Feature: update And a directory named "moduleroot" When I run `msync update -m 'deletes a file that doesnt exist!' -f puppet-test` And the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Setting a directory to unmanaged - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-apache" from "puppetlabs" + And a file named "managed_modules.yml" with: """ --- - - puppetlabs-apache + - puppet-apache """ And a file named "modulesync.yml" with: """ --- - namespace: puppetlabs - git_base: https://github.com/ + namespace: puppetlabs """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -488,26 +561,29 @@ Feature: update """ some spec_helper fud """ - And a directory named "modules/puppetlabs/puppetlabs-apache/spec" - And a file named "modules/puppetlabs/puppetlabs-apache/spec/spec_helper.rb" with: + And a directory named "modules/puppetlabs/puppet-apache/spec" + And a file named "modules/puppetlabs/puppet-apache/spec/spec_helper.rb" with: """ This is a fake spec_helper! """ When I run `msync update --offline` Then the output should contain: """ - Not managing spec/spec_helper.rb in puppetlabs-apache + Not managing spec/spec_helper.rb in puppet-apache """ And the exit status should be 0 - Given I run `cat modules/puppetlabs/puppetlabs-apache/spec/spec_helper.rb` + Given I run `cat modules/puppetlabs/puppet-apache/spec/spec_helper.rb` Then the output should contain: """ This is a fake spec_helper! """ And the exit status should be 0 + And the puppet module "puppet-apache" from "puppetlabs" should have no commits made by "Aruba" Scenario: Adding a new file in a new subdirectory - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -515,9 +591,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -543,9 +619,12 @@ Feature: update """ require 'puppetlabs_spec_helper/module_helper' """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Updating offline - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -553,9 +632,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -572,9 +651,12 @@ Feature: update When I run `msync update --offline` Then the exit status should be 0 And the output should not match /Files (changed|added|deleted):/ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Pulling a module that already exists in the modules directory - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - maestrodev/puppet-test @@ -582,9 +664,13 @@ Feature: update And a file named "modulesync.yml" with: """ --- - git_base: https://github.com/ + namespace: maestrodev """ - And a file named "config_defaults.yml" with: + And a git_base option appended to "modulesync.yml" for local tests + When I run `msync update` + Then the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + Given a file named "config_defaults.yml" with: """ --- spec/spec_helper.rb: @@ -597,20 +683,6 @@ Feature: update require '<%= required %>' <% end %> """ - Given I run `git init modules/maestrodev/puppet-test` - Given a file named "modules/maestrodev/puppet-test/.git/config" with: - """ - [core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true - [remote "origin"] - url = https://github.com/maestrodev/puppet-test.git - fetch = +refs/heads/*:refs/remotes/origin/* - """ When I run `msync update --noop` Then the exit status should be 0 And the output should match: @@ -618,9 +690,12 @@ Feature: update Files added: spec/spec_helper.rb """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: When running update with no changes - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -628,16 +703,18 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" - When I run `msync update --noop` + When I run `msync update` Then the exit status should be 0 - And the output should not match /diff/ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- puppet-test: @@ -646,9 +723,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -669,9 +746,13 @@ Feature: update """ Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml and using a filter - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-blacksmith" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- puppet-blacksmith: @@ -681,9 +762,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -705,9 +786,13 @@ Feature: update Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" And a directory named "modules/maestrodev/puppet-blacksmith" should not exist + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml and using a negative filter - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-blacksmith" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- puppet-blacksmith: @@ -717,9 +802,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -741,9 +826,12 @@ Feature: update Given I run `cat modules/maestrodev/puppet-test/test` Then the output should contain "aruba" And a directory named "modules/maestrodev/puppet-blacksmith" should not exist + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Updating a module with a .sync.yml file - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - maestrodev/puppet-test @@ -751,8 +839,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -775,21 +864,7 @@ Feature: update <%= @configs['global-to-overwrite'] %> <%= @configs['module-default'] %> """ - Given I run `git init modules/maestrodev/puppet-test` - Given a file named "modules/maestrodev/puppet-test/.git/config" with: - """ - [core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true - [remote "origin"] - url = https://github.com/maestrodev/puppet-test.git - fetch = +refs/heads/*:refs/remotes/origin/* - """ - Given a file named "modules/maestrodev/puppet-test/.sync.yml" with: + And the puppet module "puppet-test" from "maestrodev" has a file named ".sync.yml" with: """ --- :global: @@ -811,9 +886,13 @@ Feature: update it-is-overwritten some-value """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Module with custom namespace - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-lib-file_concat" from "electrical" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -822,9 +901,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -844,12 +923,16 @@ Feature: update test """ Given I run `cat modules/maestrodev/puppet-test/.git/config` - Then the output should contain "url = https://github.com/maestrodev/puppet-test.git" + Then the output should match /^\s+url = .*maestrodev.puppet-test$/ Given I run `cat modules/electrical/puppet-lib-file_concat/.git/config` - Then the output should contain "url = https://github.com/electrical/puppet-lib-file_concat.git" + Then the output should match /^\s+url = .*electrical.puppet-lib-file_concat$/ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-lib-file_concat" from "electrical" should have no commits made by "Aruba" Scenario: Modifying an existing file with values exposed by the module - Given a file named "managed_modules.yml" with: + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- - puppet-test @@ -857,9 +940,9 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ + namespace: maestrodev """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -868,7 +951,12 @@ Feature: update And a directory named "moduleroot" And a file named "moduleroot/README.md.erb" with: """ - echo '<%= @configs[:git_base] + @configs[:namespace] %>' + module: <%= @configs[:puppet_module] %> + namespace: <%= @configs[:namespace] %> + """ + And the puppet module "puppet-test" from "maestrodev" has a file named "README.md" with: + """ + Hello world! """ When I run `msync update --noop` Then the exit status should be 0 @@ -880,12 +968,25 @@ Feature: update Given I run `cat modules/maestrodev/puppet-test/README.md` Then the output should contain: """ - echo 'https://github.com/maestrodev' + module: puppet-test + namespace: maestrodev """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Running the same update twice and pushing to a remote branch Given a mocked git configuration - And a remote module repository + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: + """ + --- + - puppet-test + """ + And a file named "modulesync.yml" with: + """ + --- + namespace: maestrodev + """ + And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -899,15 +1000,30 @@ Feature: update """ When I run `msync update -m "Update Gemfile" -r test` Then the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "test" Given I remove the directory "modules" When I run `msync update -m "Update Gemfile" -r test` Then the exit status should be 0 Then the output should not contain "error" Then the output should not contain "rejected" + And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "test" Scenario: Creating a GitHub PR with an update Given a mocked git configuration - And a remote module repository + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: + """ + --- + - puppet-test + """ + And a file named "modulesync.yml" with: + """ + --- + namespace: maestrodev + """ + And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" And I set the environment variables to: | variable | value | @@ -915,10 +1031,22 @@ Feature: update When I run `msync update --noop --branch managed_update --pr` Then the output should contain "Would submit PR " And the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Creating a GitLab MR with an update Given a mocked git configuration - And a remote module repository + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: + """ + --- + - puppet-test + """ + And a file named "modulesync.yml" with: + """ + --- + namespace: maestrodev + """ + And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" And I set the environment variables to: | variable | value | @@ -926,10 +1054,23 @@ Feature: update When I run `msync update --noop --branch managed_update --pr` Then the output should contain "Would submit MR " And the exit status should be 0 + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" Scenario: Repository with a default branch other than master Given a mocked git configuration - And a remote module repository with "develop" as the default branch + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: + """ + --- + - puppet-test + """ + And a file named "modulesync.yml" with: + """ + --- + namespace: maestrodev + """ + And a git_base option appended to "modulesync.yml" for local tests + And the puppet module "puppet-test" from "maestrodev" has the default branch named "develop" And a file named "config_defaults.yml" with: """ --- @@ -943,23 +1084,27 @@ Feature: update """ When I run `msync update -m "Update Gemfile"` Then the exit status should be 0 - Then the output should contain "Using repository's default branch: develop" + And the output should contain "Using repository's default branch: develop" + And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "develop" - Scenario: Adding a new file from a template using meta data - And a file named "config_defaults.yml" with: + Scenario: Adding a new file from a template using metadata + Given a mocked git configuration + And a puppet module "puppet-test" from "maestrodev" + And a file named "managed_modules.yml" with: """ --- + - puppet-test """ - Given a file named "managed_modules.yml" with: + And a file named "modulesync.yml" with: """ --- - - puppet-test + namespace: maestrodev """ - And a file named "modulesync.yml" with: + And a git_base option appended to "modulesync.yml" for local tests + And a file named "config_defaults.yml" with: """ --- - namespace: maestrodev - git_base: https://github.com/ """ And a directory named "moduleroot" And a file named "moduleroot/test.erb" with: @@ -977,3 +1122,4 @@ Feature: update target: modules/maestrodev/puppet-test/test workdir: modules/maestrodev/puppet-test """ + And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" From 8bfbad57fd3b03b782d9093e9c1aec5639c43e0d Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:39:54 +0100 Subject: [PATCH 06/10] Tests: Remove unused steps --- features/step_definitions/git_steps.rb | 41 -------------------------- 1 file changed, 41 deletions(-) diff --git a/features/step_definitions/git_steps.rb b/features/step_definitions/git_steps.rb index f218f873..970120ed 100644 --- a/features/step_definitions/git_steps.rb +++ b/features/step_definitions/git_steps.rb @@ -55,44 +55,3 @@ pmrr = ModuleSync::Faker::PuppetModuleRemoteRepo.new(name, namespace) pmrr.default_branch = default_branch end - -Given 'a remote module repository' do - steps %( - Given a directory named "sources" - And I run `git clone https://github.com/maestrodev/puppet-test sources/puppet-test` - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - ) - 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| - 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 - """ - ) - 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 From 575781fd0c68f5e80b43625f419b3e259aeb0c9b Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sat, 19 Dec 2020 22:40:51 +0100 Subject: [PATCH 07/10] Tests: Rename maestrodev namespace to fakenamespace 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. --- features/cli.feature | 6 +- features/update.feature | 258 ++++++++++++++++++++-------------------- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/features/cli.feature b/features/cli.feature index afa08699..f4ad61ed 100644 --- a/features/cli.feature +++ b/features/cli.feature @@ -18,7 +18,7 @@ Feature: CLI And the output should match /Commands:/ Scenario: When overriding a setting from the config file on the command line - Given a puppet module "puppet-test" from "maestrodev" + Given a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -31,6 +31,6 @@ Feature: CLI """ And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" - When I run `msync update --noop --namespace maestrodev` + When I run `msync update --noop --namespace fakenamespace` Then the exit status should be 0 - And the output should match /Syncing maestrodev/ + And the output should match /Syncing fakenamespace/ diff --git a/features/update.feature b/features/update.feature index 5931f0b7..3903821c 100644 --- a/features/update.feature +++ b/features/update.feature @@ -3,7 +3,7 @@ Feature: update Scenario: Adding a new file Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -12,7 +12,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -33,13 +33,13 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" Scenario: Using skip_broken option and adding a new file to repo without write access Given a mocked git configuration - And a puppet module "puppet-test" from "faker" - And the puppet module "puppet-test" from "faker" is read-only + And a puppet module "puppet-test" from "fakenamespace" + And the puppet module "puppet-test" from "fakenamespace" is read-only And a file named "managed_modules.yml" with: """ --- @@ -48,7 +48,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: faker + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -64,12 +64,12 @@ Feature: update """ When I run `msync update -s -m "Add test"` Then the exit status should be 0 - And the puppet module "puppet-test" from "faker" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file to repo without write access Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" - And the puppet module "puppet-test" from "maestrodev" is read-only + And a puppet module "puppet-test" from "fakenamespace" + And the puppet module "puppet-test" from "fakenamespace" is read-only And a file named "managed_modules.yml" with: """ --- @@ -78,7 +78,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -94,11 +94,11 @@ Feature: update """ When I run `msync update -m "Add test" -r` Then the exit status should be 1 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file, without the .erb suffix Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -107,7 +107,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -132,13 +132,13 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file using global values Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -147,7 +147,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -168,13 +168,13 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file overriding global values Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -183,7 +183,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -207,13 +207,13 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file ignoring global values Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -222,7 +222,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -246,13 +246,13 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a file that ERB can't parse Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -261,7 +261,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -279,11 +279,11 @@ Feature: update """ When I run `msync update --noop` Then the exit status should be 1 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Using skip_broken option with invalid files Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -292,7 +292,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -310,11 +310,11 @@ Feature: update """ When I run `msync update --noop -s` Then the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Using skip_broken and fail_on_warnings options with invalid files Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -323,7 +323,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -341,12 +341,12 @@ Feature: update """ When I run `msync update --noop --skip_broken --fail_on_warnings` Then the exit status should be 1 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Modifying an existing file Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" - And the puppet module "puppet-test" from "maestrodev" has a file named "Gemfile" with: + And a puppet module "puppet-test" from "fakenamespace" + And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: """ source 'https://example.com' """ @@ -358,7 +358,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -379,17 +379,17 @@ Feature: update Files changed: +diff --git a/Gemfile b/Gemfile """ - Given I run `cat modules/maestrodev/puppet-test/Gemfile` + Given I run `cat modules/fakenamespace/puppet-test/Gemfile` Then the output should contain: """ source 'https://somehost.com' """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Modifying an existing file and committing the change Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" - And the puppet module "puppet-test" from "maestrodev" has a file named "Gemfile" with: + And a puppet module "puppet-test" from "fakenamespace" + And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: """ source 'https://example.com' """ @@ -401,7 +401,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -417,17 +417,17 @@ Feature: update """ When I run `msync update -m "Update Gemfile" -r test` Then the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" - And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "test" - And the puppet module "puppet-test" from "maestrodev" should have a branch "test" with a file named "Gemfile" which contains: + And the puppet module "puppet-test" from "fakenamespace" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have 1 commit made by "Aruba" in branch "test" + And the puppet module "puppet-test" from "fakenamespace" should have a branch "test" with a file named "Gemfile" which contains: """ source 'https://somehost.com' """ Scenario: Setting an existing file to unmanaged Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" - And the puppet module "puppet-test" from "maestrodev" has a file named "Gemfile" with: + And a puppet module "puppet-test" from "fakenamespace" + And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: """ source 'https://rubygems.org' """ @@ -439,7 +439,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -465,16 +465,16 @@ Feature: update Not managing Gemfile in puppet-test """ And the exit status should be 0 - Given I run `cat modules/maestrodev/puppet-test/Gemfile` + Given I run `cat modules/fakenamespace/puppet-test/Gemfile` Then the output should contain: """ source 'https://rubygems.org' """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Setting an existing file to deleted Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -483,7 +483,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -509,11 +509,11 @@ Feature: update deleted file mode 100644 """ And the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Setting a non-existent file to deleted Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -522,7 +522,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -534,7 +534,7 @@ Feature: update And a directory named "moduleroot" When I run `msync update -m 'deletes a file that doesnt exist!' -f puppet-test` And the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Setting a directory to unmanaged Given a mocked git configuration @@ -582,7 +582,7 @@ Feature: update Scenario: Adding a new file in a new subdirectory Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -591,7 +591,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -614,16 +614,16 @@ Feature: update Files added: spec/spec_helper.rb """ - Given I run `cat modules/maestrodev/puppet-test/spec/spec_helper.rb` + Given I run `cat modules/fakenamespace/puppet-test/spec/spec_helper.rb` Then the output should contain: """ require 'puppetlabs_spec_helper/module_helper' """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Updating offline Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -632,7 +632,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -651,25 +651,25 @@ Feature: update When I run `msync update --offline` Then the exit status should be 0 And the output should not match /Files (changed|added|deleted):/ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Pulling a module that already exists in the modules directory Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- - - maestrodev/puppet-test + - fakenamespace/puppet-test """ And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests When I run `msync update` Then the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Given a file named "config_defaults.yml" with: """ --- @@ -690,11 +690,11 @@ Feature: update Files added: spec/spec_helper.rb """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When running update with no changes Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -703,17 +703,17 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" When I run `msync update` Then the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -723,7 +723,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -744,14 +744,14 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml and using a filter Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" - And a puppet module "puppet-blacksmith" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" + And a puppet module "puppet-blacksmith" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -762,7 +762,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -783,15 +783,15 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And a directory named "modules/maestrodev/puppet-blacksmith" should not exist - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And a directory named "modules/fakenamespace/puppet-blacksmith" should not exist + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml and using a negative filter Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" - And a puppet module "puppet-blacksmith" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" + And a puppet module "puppet-blacksmith" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -802,7 +802,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -823,23 +823,23 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain "aruba" - And a directory named "modules/maestrodev/puppet-blacksmith" should not exist - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And a directory named "modules/fakenamespace/puppet-blacksmith" should not exist + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Updating a module with a .sync.yml file Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- - - maestrodev/puppet-test + - fakenamespace/puppet-test """ And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -864,7 +864,7 @@ Feature: update <%= @configs['global-to-overwrite'] %> <%= @configs['module-default'] %> """ - And the puppet module "puppet-test" from "maestrodev" has a file named ".sync.yml" with: + And the puppet module "puppet-test" from "fakenamespace" has a file named ".sync.yml" with: """ --- :global: @@ -879,18 +879,18 @@ Feature: update """ Not managing spec/spec_helper.rb in puppet-test """ - Given I run `cat modules/maestrodev/puppet-test/global-test.md` + Given I run `cat modules/fakenamespace/puppet-test/global-test.md` Then the output should match: """ some-default it-is-overwritten some-value """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Module with custom namespace Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a puppet module "puppet-lib-file_concat" from "electrical" And a file named "managed_modules.yml" with: """ @@ -901,7 +901,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -922,16 +922,16 @@ Feature: update Files added: test """ - Given I run `cat modules/maestrodev/puppet-test/.git/config` - Then the output should match /^\s+url = .*maestrodev.puppet-test$/ + Given I run `cat modules/fakenamespace/puppet-test/.git/config` + Then the output should match /^\s+url = .*fakenamespace.puppet-test$/ Given I run `cat modules/electrical/puppet-lib-file_concat/.git/config` Then the output should match /^\s+url = .*electrical.puppet-lib-file_concat$/ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" And the puppet module "puppet-lib-file_concat" from "electrical" should have no commits made by "Aruba" Scenario: Modifying an existing file with values exposed by the module Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -940,7 +940,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -954,7 +954,7 @@ Feature: update module: <%= @configs[:puppet_module] %> namespace: <%= @configs[:namespace] %> """ - And the puppet module "puppet-test" from "maestrodev" has a file named "README.md" with: + And the puppet module "puppet-test" from "fakenamespace" has a file named "README.md" with: """ Hello world! """ @@ -965,17 +965,17 @@ Feature: update Files changed: +diff --git a/README.md b/README.md """ - Given I run `cat modules/maestrodev/puppet-test/README.md` + Given I run `cat modules/fakenamespace/puppet-test/README.md` Then the output should contain: """ module: puppet-test - namespace: maestrodev + namespace: fakenamespace """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Running the same update twice and pushing to a remote branch Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -984,7 +984,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -1000,19 +1000,19 @@ Feature: update """ When I run `msync update -m "Update Gemfile" -r test` Then the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" - And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "test" + And the puppet module "puppet-test" from "fakenamespace" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have 1 commit made by "Aruba" in branch "test" Given I remove the directory "modules" When I run `msync update -m "Update Gemfile" -r test` Then the exit status should be 0 Then the output should not contain "error" Then the output should not contain "rejected" - And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" - And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "test" + And the puppet module "puppet-test" from "fakenamespace" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have 1 commit made by "Aruba" in branch "test" Scenario: Creating a GitHub PR with an update Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -1021,7 +1021,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" @@ -1031,11 +1031,11 @@ Feature: update When I run `msync update --noop --branch managed_update --pr` Then the output should contain "Would submit PR " And the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Creating a GitLab MR with an update Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -1044,7 +1044,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a directory named "moduleroot" @@ -1054,11 +1054,11 @@ Feature: update When I run `msync update --noop --branch managed_update --pr` Then the output should contain "Would submit MR " And the exit status should be 0 - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Repository with a default branch other than master Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -1067,10 +1067,10 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests - And the puppet module "puppet-test" from "maestrodev" has the default branch named "develop" + And the puppet module "puppet-test" from "fakenamespace" has the default branch named "develop" And a file named "config_defaults.yml" with: """ --- @@ -1085,12 +1085,12 @@ Feature: update When I run `msync update -m "Update Gemfile"` Then the exit status should be 0 And the output should contain "Using repository's default branch: develop" - And the puppet module "puppet-test" from "maestrodev" should have only 1 commit made by "Aruba" - And the puppet module "puppet-test" from "maestrodev" should have 1 commit made by "Aruba" in branch "develop" + And the puppet module "puppet-test" from "fakenamespace" should have only 1 commit made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have 1 commit made by "Aruba" in branch "develop" Scenario: Adding a new file from a template using metadata Given a mocked git configuration - And a puppet module "puppet-test" from "maestrodev" + And a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- @@ -1099,7 +1099,7 @@ Feature: update And a file named "modulesync.yml" with: """ --- - namespace: maestrodev + namespace: fakenamespace """ And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: @@ -1115,11 +1115,11 @@ Feature: update """ When I run `msync update --noop` Then the exit status should be 0 - Given I run `cat modules/maestrodev/puppet-test/test` + Given I run `cat modules/fakenamespace/puppet-test/test` Then the output should contain: """ module: puppet-test - target: modules/maestrodev/puppet-test/test - workdir: modules/maestrodev/puppet-test + target: modules/fakenamespace/puppet-test/test + workdir: modules/fakenamespace/puppet-test """ - And the puppet module "puppet-test" from "maestrodev" should have no commits made by "Aruba" + And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" From 34aaf91754ad31d87f7f3235c7fed11891fa6fd4 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sat, 19 Dec 2020 23:36:01 +0100 Subject: [PATCH 08/10] Tests: Replace cat usage by aruba file matcher --- features/hook.feature | 8 +++---- features/update.feature | 51 ++++++++++++++--------------------------- 2 files changed, 20 insertions(+), 39 deletions(-) diff --git a/features/hook.feature b/features/hook.feature index 10e97909..cae008e9 100644 --- a/features/hook.feature +++ b/features/hook.feature @@ -5,8 +5,7 @@ Feature: hook Given a directory named ".git/hooks" When I run `msync hook activate` Then the exit status should be 0 - Given I run `cat .git/hooks/pre-push` - Then the output should contain "bash" + And the file named ".git/hooks/pre-push" should contain "bash" Scenario: Deactivating a hook Given a file named ".git/hooks/pre-push" with: @@ -21,8 +20,7 @@ Feature: hook Given a directory named ".git/hooks" When I run `msync hook activate -a '--foo bar --baz quux' -b master` Then the exit status should be 0 - Given I run `cat .git/hooks/pre-push` - Then the output should match: + And the file named ".git/hooks/pre-push" should contain: """ - "\$message" -n puppetlabs -b master --foo bar --baz quux + "$message" -n puppetlabs -b master --foo bar --baz quux """ diff --git a/features/update.feature b/features/update.feature index 3903821c..a05adec3 100644 --- a/features/update.feature +++ b/features/update.feature @@ -33,8 +33,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" Scenario: Using skip_broken option and adding a new file to repo without write access Given a mocked git configuration @@ -132,8 +131,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file using global values @@ -168,8 +166,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file overriding global values @@ -207,8 +204,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file ignoring global values @@ -246,8 +242,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a file that ERB can't parse @@ -379,8 +374,7 @@ Feature: update Files changed: +diff --git a/Gemfile b/Gemfile """ - Given I run `cat modules/fakenamespace/puppet-test/Gemfile` - Then the output should contain: + And the file named "modules/fakenamespace/puppet-test/Gemfile" should contain: """ source 'https://somehost.com' """ @@ -465,8 +459,7 @@ Feature: update Not managing Gemfile in puppet-test """ And the exit status should be 0 - Given I run `cat modules/fakenamespace/puppet-test/Gemfile` - Then the output should contain: + And the file named "modules/fakenamespace/puppet-test/Gemfile" should contain: """ source 'https://rubygems.org' """ @@ -572,8 +565,7 @@ Feature: update Not managing spec/spec_helper.rb in puppet-apache """ And the exit status should be 0 - Given I run `cat modules/puppetlabs/puppet-apache/spec/spec_helper.rb` - Then the output should contain: + And the file named "modules/puppetlabs/puppet-apache/spec/spec_helper.rb" should contain: """ This is a fake spec_helper! """ @@ -614,8 +606,7 @@ Feature: update Files added: spec/spec_helper.rb """ - Given I run `cat modules/fakenamespace/puppet-test/spec/spec_helper.rb` - Then the output should contain: + And the file named "modules/fakenamespace/puppet-test/spec/spec_helper.rb" should contain: """ require 'puppetlabs_spec_helper/module_helper' """ @@ -744,8 +735,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml and using a filter @@ -783,8 +773,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And a directory named "modules/fakenamespace/puppet-blacksmith" should not exist And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" @@ -823,8 +812,7 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain "aruba" + And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" And a directory named "modules/fakenamespace/puppet-blacksmith" should not exist And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" @@ -879,8 +867,7 @@ Feature: update """ Not managing spec/spec_helper.rb in puppet-test """ - Given I run `cat modules/fakenamespace/puppet-test/global-test.md` - Then the output should match: + And the file named "modules/fakenamespace/puppet-test/global-test.md" should contain: """ some-default it-is-overwritten @@ -922,10 +909,8 @@ Feature: update Files added: test """ - Given I run `cat modules/fakenamespace/puppet-test/.git/config` - Then the output should match /^\s+url = .*fakenamespace.puppet-test$/ - Given I run `cat modules/electrical/puppet-lib-file_concat/.git/config` - Then the output should match /^\s+url = .*electrical.puppet-lib-file_concat$/ + And the file named "modules/fakenamespace/puppet-test/.git/config" should match /^\s+url = .*fakenamespace.puppet-test$/ + And the file named "modules/electrical/puppet-lib-file_concat/.git/config" should match /^\s+url = .*electrical.puppet-lib-file_concat$/ And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" And the puppet module "puppet-lib-file_concat" from "electrical" should have no commits made by "Aruba" @@ -965,8 +950,7 @@ Feature: update Files changed: +diff --git a/README.md b/README.md """ - Given I run `cat modules/fakenamespace/puppet-test/README.md` - Then the output should contain: + And the file named "modules/fakenamespace/puppet-test/README.md" should contain: """ module: puppet-test namespace: fakenamespace @@ -1115,8 +1099,7 @@ Feature: update """ When I run `msync update --noop` Then the exit status should be 0 - Given I run `cat modules/fakenamespace/puppet-test/test` - Then the output should contain: + And the file named "modules/fakenamespace/puppet-test/test" should contain: """ module: puppet-test target: modules/fakenamespace/puppet-test/test From ded9f0868638c165ebd976e7a59537c24db5a3c1 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:06:58 +0100 Subject: [PATCH 09/10] Tests: Provide a step to setup a msync with one puppet module This commit adds a "basic setup" step in order to reduce scenario verbosity and help to focus on important steps --- features/step_definitions/git_steps.rb | 18 ++ features/update.feature | 387 ++----------------------- 2 files changed, 46 insertions(+), 359 deletions(-) diff --git a/features/step_definitions/git_steps.rb b/features/step_definitions/git_steps.rb index 970120ed..2db998f7 100644 --- a/features/step_definitions/git_steps.rb +++ b/features/step_definitions/git_steps.rb @@ -1,5 +1,23 @@ require_relative '../../spec/helpers/faker/puppet_module_remote_repo' +Given 'a basic setup with a puppet module {string} from {string}' do |name, namespace| + steps %( + Given a mocked git configuration + And a puppet module "#{name}" from "#{namespace}" + And a file named "managed_modules.yml" with: + """ + --- + - #{name} + """ + And a file named "modulesync.yml" with: + """ + --- + namespace: #{namespace} + """ + And a git_base option appended to "modulesync.yml" for local tests + ) +end + Given 'a mocked git configuration' do steps %( Given a mocked home directory diff --git a/features/update.feature b/features/update.feature index a05adec3..dd096cf7 100644 --- a/features/update.feature +++ b/features/update.feature @@ -2,19 +2,7 @@ Feature: update ModuleSync needs to update module boilerplate Scenario: Adding a new file - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -36,20 +24,8 @@ Feature: update And the file named "modules/fakenamespace/puppet-test/test" should contain "aruba" Scenario: Using skip_broken option and adding a new file to repo without write access - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And the puppet module "puppet-test" from "fakenamespace" is read-only - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -66,20 +42,8 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file to repo without write access - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And the puppet module "puppet-test" from "fakenamespace" is read-only - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -96,19 +60,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file, without the .erb suffix - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -135,19 +87,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file using global values - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -170,19 +110,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file overriding global values - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -208,19 +136,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a new file ignoring global values - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -246,19 +162,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Adding a file that ERB can't parse - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -277,19 +181,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Using skip_broken option with invalid files - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -308,19 +200,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Using skip_broken and fail_on_warnings options with invalid files - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -339,23 +219,11 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Modifying an existing file - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: """ source 'https://example.com' """ - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -381,23 +249,11 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Modifying an existing file and committing the change - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: """ source 'https://example.com' """ - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -419,23 +275,11 @@ Feature: update """ Scenario: Setting an existing file to unmanaged - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And the puppet module "puppet-test" from "fakenamespace" has a file named "Gemfile" with: """ source 'https://rubygems.org' """ - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -466,19 +310,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Setting an existing file to deleted - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -505,19 +337,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Setting a non-existent file to deleted - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -530,19 +350,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Setting a directory to unmanaged - Given a mocked git configuration - And a puppet module "puppet-apache" from "puppetlabs" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-apache - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: puppetlabs - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-apache" from "puppetlabs" And a file named "config_defaults.yml" with: """ --- @@ -573,19 +381,7 @@ Feature: update And the puppet module "puppet-apache" from "puppetlabs" should have no commits made by "Aruba" Scenario: Adding a new file in a new subdirectory - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -613,19 +409,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Updating offline - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -645,19 +429,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Pulling a module that already exists in the modules directory - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - fakenamespace/puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" When I run `msync update` Then the exit status should be 0 And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" @@ -684,39 +456,20 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When running update with no changes - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a directory named "moduleroot" When I run `msync update` Then the exit status should be 0 And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: When specifying configurations in managed_modules.yml - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "managed_modules.yml" with: """ --- puppet-test: module_name: test """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests And a file named "config_defaults.yml" with: """ --- @@ -817,19 +570,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Updating a module with a .sync.yml file - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - fakenamespace/puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -915,19 +656,7 @@ Feature: update And the puppet module "puppet-lib-file_concat" from "electrical" should have no commits made by "Aruba" Scenario: Modifying an existing file with values exposed by the module - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -958,19 +687,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Running the same update twice and pushing to a remote branch - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- @@ -995,19 +712,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have 1 commit made by "Aruba" in branch "test" Scenario: Creating a GitHub PR with an update - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a directory named "moduleroot" And I set the environment variables to: | variable | value | @@ -1018,19 +723,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Creating a GitLab MR with an update - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a directory named "moduleroot" And I set the environment variables to: | variable | value | @@ -1041,19 +734,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have no commits made by "Aruba" Scenario: Repository with a default branch other than master - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And the puppet module "puppet-test" from "fakenamespace" has the default branch named "develop" And a file named "config_defaults.yml" with: """ @@ -1073,19 +754,7 @@ Feature: update And the puppet module "puppet-test" from "fakenamespace" should have 1 commit made by "Aruba" in branch "develop" Scenario: Adding a new file from a template using metadata - Given a mocked git configuration - And a puppet module "puppet-test" from "fakenamespace" - And a file named "managed_modules.yml" with: - """ - --- - - puppet-test - """ - And a file named "modulesync.yml" with: - """ - --- - namespace: fakenamespace - """ - And a git_base option appended to "modulesync.yml" for local tests + Given a basic setup with a puppet module "puppet-test" from "fakenamespace" And a file named "config_defaults.yml" with: """ --- From 563deb3a90473f53d49f71f5dd6499c5ec6c8833 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Sun, 20 Dec 2020 00:11:36 +0100 Subject: [PATCH 10/10] Cucumber: Silent message about publishing results --- .config/cucumber.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .config/cucumber.yml diff --git a/.config/cucumber.yml b/.config/cucumber.yml new file mode 100644 index 00000000..fea5edc1 --- /dev/null +++ b/.config/cucumber.yml @@ -0,0 +1 @@ +default: --publish-quiet