Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/296965
Change subject: (WIP) rspec config for the whole repository (WIP) ...................................................................... (WIP) rspec config for the whole repository (WIP) This is an attempt at being able to run rspec from the root of the repository and have it executes all the spec we have. Usage: bundle install bundle exec rspec In .rspec: exclude the mysql module, it is no more used in production and tests are mostly broken. Very basic hiera fixtures. That does not load the modules fixtures though. Get rspec to persist scenario result in /.rspec_status so one can rerun just the last failing test (--next-failure) or only the failing ones (--only-failures. Add it to /.gitignore. Bug: T78342 Change-Id: I7cc784a40fb41d6a4fa9a12a73e852d5877892a7 --- M .gitignore A .rspec A spec/README A spec/fixtures/hiera.yaml A spec/fixtures/hieradata/common.yaml A spec/fixtures/site.pp A spec/spec_helper.rb 7 files changed, 40 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/65/296965/1 diff --git a/.gitignore b/.gitignore index 99f1aa3..3a6121f 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ # Jetbrain's IDEA editor settings /.idea -/*.iml \ No newline at end of file +/*.iml + +# rspec status persistence for --next-failure +/.rspec_status diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..c945d9e --- /dev/null +++ b/.rspec @@ -0,0 +1,4 @@ +--format doc +--color +--pattern 'modules/*/spec/**/*_spec.rb' +--exclude-pattern 'modules/mysql/spec/**/*_spec.rb' diff --git a/spec/README b/spec/README new file mode 100644 index 0000000..afc33eb --- /dev/null +++ b/spec/README @@ -0,0 +1,4 @@ +From the root of the repository: + + bundle install + bundle exec rspec diff --git a/spec/fixtures/hiera.yaml b/spec/fixtures/hiera.yaml new file mode 100644 index 0000000..4f2ee1c --- /dev/null +++ b/spec/fixtures/hiera.yaml @@ -0,0 +1,6 @@ +:backends: + - yaml +:yaml: + :datadir: 'spec/fixtures/hieradata' +:hierarchy: + - common diff --git a/spec/fixtures/hieradata/common.yaml b/spec/fixtures/hieradata/common.yaml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/spec/fixtures/hieradata/common.yaml diff --git a/spec/fixtures/site.pp b/spec/fixtures/site.pp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/spec/fixtures/site.pp diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..f70197a --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,22 @@ +require 'rspec-puppet' +require 'puppetlabs_spec_helper/module_spec_helper' + +base_path = File.expand_path(File.dirname(File.dirname(__FILE__))) +fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) + +Dir.glob('modules/*/lib').each do |module_lib| + $LOAD_PATH.unshift module_lib +end + +RSpec.configure do |c| + c.example_status_persistence_file_path = '.rspec_status' + c.run_all_when_everything_filtered = true + + c.manifest_dir = File.join(base_path, 'manifests') + c.module_path = File.join(base_path, 'modules') + c.template_dir = File.join(base_path, 'templates') + + # Fixtures + c.manifest = File.join(fixture_path, 'site.pp') + c.hiera_config = File.join(fixture_path, 'hiera.yaml') +end -- To view, visit https://gerrit.wikimedia.org/r/296965 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7cc784a40fb41d6a4fa9a12a73e852d5877892a7 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Hashar <has...@free.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits