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

Drop Foreman plugin testing #432

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
41 changes: 5 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,48 +80,16 @@ Current PR test jobs (used on Foreman itself) support these commands:

## Quick reference for plugin maintainers

### Foreman plugin testing

Foreman plugins are tested by adding the plugin to a Foreman checkout and running core tests, so it checks that existing behaviours still work and new plugin tests are run too. The [test_plugin_matrix job](https://ci.theforeman.org/job/test_plugin_matrix/) copies the core jobs, but adds a plugin from a given git repo/branch and is usually used to test plugins in a generic way.

Each plugin should have a job defined in JJB that calls test_plugin_matrix here: https://ci.theforeman.org/view/Plugins/

#### Foreman plugin PR testing

To test pull requests, a separate job is used that also takes the PR details: https://ci.theforeman.org/view/Plugins/job/test_plugin_pull_request/

#### Adding a new Foreman plugin

For a plugin "foreman_example", first create a job that tests the main (master or develop) branch.

* ensure plugin tests (if any) run when `rake jenkins:unit` is called, see [the example plugin](https://github.com/theforeman/foreman_plugin_template/) and [testing a plugin](https://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Testing) for help
* create a foreman_example.yaml file in [theforeman.org/yaml/jobs/plugins](https://github.com/theforeman/jenkins-jobs/tree/master/theforeman.org/yaml/jobs/plugins)
* This will create a "test_plugin_foreman_example_master" job in Jenkins to test the master branch.
* ensure the job is green by fixing bugs, installing dependencies etc.
* add hook to GitHub repo, see [GitHub repo hook](#testing-develop)

An org admin must then:

* add the repo to the [Bots team](https://github.com/orgs/theforeman/teams/bots/repositories) with **write** access

### Smart proxy plugin testing

Proxy plugins are tested like ordinary gems with tests run entirely from the plugin directory, installing the smart proxy as a dependency (via bundler's git support). The [test_proxy_plugin_matrix job](https://ci.theforeman.org/job/test_proxy_plugin_matrix/) is usually used to test plugins in a generic way.

Each plugin should have a job defined in JJB that calls test_proxy_plugin_matrix here: https://ci.theforeman.org/view/Plugins/

#### Smart proxy plugin PR testing

To test pull requests, a separate job is used that also takes the PR details: https://ci.theforeman.org/view/Plugins/job/test_proxy_plugin_pull_request/

### Adding a new smart proxy plugin
Proxy plugins are tested like ordinary gems with tests run entirely from the plugin directory, installing the smart proxy as a dependency (via bundler's git support).

For a plugin "smart_proxy_example", first create a job that tests the main (master or develop) branch.
To add testing for a plugin `smart_proxy_example` do the following:

* ensure plugin tests run when doing `bundle install` and `rake test`, see [testing a plugin](https://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Smart-Proxy_Plugin#Testing) for help
* if different branches rely on different versions of smart proxy, specify `:branch` in Gemfile on those branches
* create a smart_proxy_example.yaml file in [theforeman.org/yaml/jobs/plugins](https://github.com/theforeman/jenkins-jobs/tree/master/theforeman.org/yaml/jobs/plugins)
* This will create a "test_proxy_plugin_smart_proxy_example_master" job in Jenkins to test the master branch.
* add the project in [theforeman.org/yaml/jobs/smart-proxy-plugin.yaml](https://github.com/theforeman/jenkins-jobs/tree/master/theforeman.org/yaml/jobs/smart-proxy-plugin.yaml) to create a `smart-proxy-example-test` job in Jenkins to test the master branch.
* add the project in [theforeman.org/yaml/jobs/smart-proxy-plugin-pr-test.yaml](https://github.com/theforeman/jenkins-jobs/tree/master/theforeman.org/yaml/jobs/tests/smart-proxy-plugin-pr-test.yaml) to create a `smart_proxy_example-pr-test` job in Jenkins to test PRs.
* ensure the job is green by fixing bugs, installing dependencies etc.
* add hook to GitHub repo, see [GitHub repo hook](#testing-develop)

Expand All @@ -136,6 +104,7 @@ Jenkins is not the only place tests are defined and executed.
## GitHub Actions

Several repositories use [GitHub Actions](https://github.com/features/actions) either *instead of* or *together with* Jenkins.
They commonly use our [reusable actions](https://github.com/theforeman/actions).

The definitions of these jobs are in `.github/workflows/` of their respective repositories.

Expand Down
4 changes: 0 additions & 4 deletions theforeman.org/yaml/builders/test_plugin.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions theforeman.org/yaml/jobs/plugins/puppetdb_foreman.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions theforeman.org/yaml/jobs/test_plugin.yaml

This file was deleted.

56 changes: 0 additions & 56 deletions theforeman.org/yaml/jobs/test_plugin_matrix.yaml

This file was deleted.