Project

General

Profile

« Previous | Next » 

Revision bef5bd62

Added by Ewoud Kohl van Wijngaarden over 2 years ago

Rewrite migration spec

This refactors the migration spec to be more focused on the actual
testing by removing a lot of duplication.

In places where there is very little in the actual fixture, the test is
rewritten to test it inline or provide the answers inline. This makes it
easier to follow what's going on.

Care has been taken to get decent naming in the output:

$ bundle exec rspec --format documentation spec/migration_spec.rb
with all migrations
on the scenario
foreman
does not change the scenario config
does not change the scenario answers
foreman-proxy-content
does not change the scenario config
does not change the scenario answers
katello
does not change the scenario config
does not change the scenario answers
on katello
with fixture pulpcore-migration
matches the answers fixture
with fixture pulpcore-migration-rpm-only
matches the answers fixture
with fixture pulpcore-migration-dont-use-content-plugins-on-upgrades
matches the answers fixture
the migration 20210625142707_dynamic_puppet_in_foreman_groups
on foreman
removes puppet
on katello
removes puppet
the migration 200818160950-remove_tuning_fact on foreman-proxy-content
removes facts
the migration 20210929144850_disable_puppet_plugins_if_undesired
on foreman
keeps foreman::cli disabled
adds foreman::cli::puppet disabled
keeps foreman disabled
adds foreman::plugin::puppet disabled
on katello
keeps foreman::cli disabled
adds foreman::cli::puppet disabled
keeps foreman disabled
adds foreman::plugin::puppet disabled
the migration 181213211252-merged-installer
on foreman-proxy-content
matches the scenario fixture
on katello
matches the scenario fixture
Finished in 0.6798 seconds (files took 0.27722 seconds to load)
22 examples, 0 failures

This makes it possible to find out where it failed. Errors look like
this:

Failures:
1) with all migrations the migration 20210625142707_dynamic_puppet_in_foreman_groups on foreman removes puppet
Failure/Error: expect(migrated_answers['foreman']['user_groups']).to eq ['a']
expected: ["a"]
got: []
  1. ./spec/migration_spec.rb:57:in `block (5 levels) in <top (required)>'
  2. /usr/share/gems/gems/bundler-2.2.22/libexec/bundle:49:in `block in <top (required)>'
  3. /usr/share/gems/gems/bundler-2.2.22/libexec/bundle:37:in `<top (required)>'
(compared using ==)

Technically the migration has a different name on Foreman and Katello,
but that's somewhat easy to figure out and painful to solve so it has to
be taken for granted now.

  • added
  • modified
  • copied
  • renamed
  • deleted