Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CONTRIBUTING with acceptance testing steps #150

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion moduleroot/CONTRIBUTING.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Checklist (and a short version for the impatient)
description (50 characters is the soft limit, excluding ticket
number(s)), and should skip the full stop.

- If you have a [https://projects.theforeman.org/projects/puppet-foreman/issues](Redmine issue)
- If you have a [Redmine issue](https://projects.theforeman.org/projects/puppet-foreman/issues)
number, associate the issue in the message. The first line should start
with the issue number in the form "fixes #XXXX - rest of message".
[More information on the Redmine style](https://projects.theforeman.org/projects/foreman/wiki/Reviewing_patches-commit_message_format).
Expand Down Expand Up @@ -206,6 +206,35 @@ SPEC_FACTS_OS=redhat bundle exec rspec spec/classes/foreman_spec.rb
For more information on running the tests, see [rspec-puppet-facts](https://github.com/mcanevet/rspec-puppet-facts)
and specifically the [section for running tests](https://github.com/mcanevet/rspec-puppet-facts#running-your-tests).

**Running acceptance tests locally**

1. Make sure you've met Prerequisites.

2. Acceptance tests are running within a VM, so make sure you have installed:
- `docker` **or**
- `vagrant` with `VirtualBox` as the provider **or**
- `vagrant` and `vagrant-libvirt` with `libvirt` as the provider

For more dependencies please see related information for picked variant.
Additonal info can be found at [voxpupuli-acceptance](https://github.com/voxpupuli/voxpupuli-acceptance/#running-tests) which is used to run the tests.

3. For first (or clean) runs, run:
- `bundle exec rake spec_clean && bundle exec rake spec_prep`

This will make sure all needed modules are prepared to be used in a VM.

4. Run the tests:
- `BEAKER_HYPERVISOR=vagrant_libvirt bundle exec rspec`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be bundle exec rake beaker?

rspec didn't work for me, while rake beaker does

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I've never run rake beaker, but rspec :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might very well be my setup :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intended command is rake beaker for the whole acceptance test suite. That already depends on spec_prep so that isn't a separate step.

If you just run rspec then you may also run unit tests.

- Use `bundle exec rspec spec/acceptance/my_test.rb -e "test"` to run a specific test as you'd usually do with `rspec`.

This will use `vagrant` and `libvirt` as the provider to create a VM and will run all tests there.

5. You can additionally specify:
- `BEAKER_PUPPET_DEBUG=yes` to make Puppet more verbose.
- `BEAKER_destroy=no` to leave the machine for further inspection in case of an error.
- Use `cd .vagrant/beaker_vagrant_files/beaker_centos8* && vagrant ssh` to SSH into VM.
- `BEAKER_provision=no` to re-use the VM again to re-run tests (e.g. small changes or new ones).

Writing Tests
-------------

Expand Down