Skip to content

Commit 3622cc5

Browse files
authored
docs: rewrite the readme and add a contributing guide (#63)
The readme opened with a description of what Busser is built on rather than what it does, and ended with a five step fork-and-branch list that was the only development documentation in the repository. Nothing told a contributor which Ruby to use, how to run either test suite, or how to lint their change. Lead instead with what Busser does and where it fits with Test Kitchen, state the Ruby requirement, and document the plugin version syntax and the BUSSER_ROOT default, neither of which appeared anywhere. Move development material into CONTRIBUTING.md and cover setup, both test suites and what each is for, the three linters CI runs, the commit convention releases depend on, and the release process itself. It also records why the plugin features sandbox GEM_HOME, since that is easy to undo by accident and cost real time to diagnose. Signed-off-by: Tim Smith <tsmith84@proton.me>
1 parent a6bb44b commit 3622cc5

2 files changed

Lines changed: 135 additions & 29 deletions

File tree

CONTRIBUTING.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Contributing to Busser
2+
3+
Thanks for taking the time to contribute. This document covers how to get the
4+
project running locally, how to check your work before opening a pull request,
5+
and the commit convention releases depend on.
6+
7+
## Getting set up
8+
9+
Busser requires **Ruby 3.2 or newer**. Clone the repository and install the
10+
development dependencies:
11+
12+
```bash
13+
git clone https://github.com/test-kitchen/busser.git
14+
cd busser
15+
bundle install
16+
```
17+
18+
Run the CLI from the working tree with `bundle exec busser`.
19+
20+
## Running the tests
21+
22+
There are two suites, and `rake` runs both:
23+
24+
```bash
25+
bundle exec rake test # everything
26+
bundle exec rake unit # minitest specs only
27+
bundle exec rake features # cucumber features only
28+
```
29+
30+
**Unit specs** live in `spec/` and cover library code directly. They use
31+
minitest's spec syntax with the `_()` expectation form:
32+
33+
```ruby
34+
_(suite_path.to_s).must_match %r{/suites$}
35+
```
36+
37+
The bare `suite_path.to_s.must_match` form was removed in minitest 6 and will
38+
not work.
39+
40+
**Cucumber features** live in `features/` and drive the real `busser`
41+
executable through [aruba](https://github.com/cucumber/aruba), so they cover
42+
the CLI end to end. The step definitions are in `lib/busser/cucumber.rb`
43+
because plugin authors reuse them.
44+
45+
Features that install plugins sandbox `GEM_HOME` into a temporary directory and
46+
strip bundler out of the environment, so a test never installs a gem into your
47+
bundle. If you add a step that shells out, be careful not to reintroduce
48+
bundler variables: modern RubyGems re-requires `bundler/setup` whenever
49+
`BUNDLER_SETUP` is present, which silently redirects `GEM_HOME` back at the
50+
bundle.
51+
52+
## Linting
53+
54+
CI runs three linters, all of which you can run locally:
55+
56+
```bash
57+
bundle exec cookstyle --chefstyle # Ruby
58+
yamllint --strict . # YAML
59+
markdownlint-cli2 "**/*.md" "!**/CHANGELOG*.md"
60+
```
61+
62+
## Commit messages
63+
64+
This project uses [Conventional Commits](https://www.conventionalcommits.org).
65+
Releases are automated, and the commit subject on `main` is what decides the
66+
next version number and what appears in the changelog.
67+
68+
Pull requests are **squash merged, so the pull request title becomes that
69+
subject**. A CI check enforces the format on the title; the individual commits
70+
on your branch are not checked.
71+
72+
| Prefix | Effect on the next release |
73+
| --- | --- |
74+
| `fix:` | Patch version bump |
75+
| `feat:` | Minor version bump |
76+
| `feat!:`, or a `BREAKING CHANGE:` footer | Major version bump |
77+
| `chore:`, `docs:`, `ci:`, `test:`, `refactor:` | No release |
78+
79+
For example:
80+
81+
```text
82+
fix: install plugins into GEM_HOME rather than the bundle
83+
feat: add a --verbose flag to plugin install
84+
ci: pin the shared workflow to a release
85+
```
86+
87+
## Opening a pull request
88+
89+
1. Fork the repository and create a branch for your change.
90+
2. Add or update tests. A bug fix should come with a test that fails without it.
91+
3. Run `bundle exec rake test` and the linters above.
92+
4. Open a pull request with a Conventional Commits title.
93+
94+
## Releases
95+
96+
Releases are handled by
97+
[release-please](https://github.com/googleapis/release-please). It watches
98+
commits landing on `main` and keeps a release pull request open with the next
99+
version number and the accumulated changelog. Merging that pull request tags
100+
the release and publishes the gem to RubyGems and GitHub Packages.
101+
102+
Maintainers do not bump `lib/busser/version.rb` or edit `CHANGELOG.md` by
103+
hand; release-please owns both files.

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,42 @@
22

33
[![Gem Version](https://badge.fury.io/rb/busser.svg)](http://badge.fury.io/rb/busser)
44

5-
Busser is a test setup and execution framework designed to
6-
work on remote nodes whose system dependencies cannot be relied upon, except
7-
for an Omnibus installation of Chef. It uses a plugin architecture to add
8-
support for different testing strategies such minitest, cucumber, bash, etc.
5+
Busser runs your integration tests on the machine under test.
6+
7+
It is built for remote nodes whose system dependencies cannot be relied upon,
8+
so it assumes very little about where it lands. Test frameworks are added as
9+
plugins, each a `busser-*` gem, which lets a single suite run bash scripts,
10+
minitest specs, RSpec examples or anything else a plugin knows how to execute.
11+
12+
Busser is normally invoked for you by
13+
[Test Kitchen](https://github.com/test-kitchen/test-kitchen), which installs it
14+
on the instance under test and runs `busser test` as part of `kitchen verify`.
15+
You can also drive it directly, which is what the rest of this document covers.
916

1017
## Status
1118

1219
This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.
1320

14-
## Installation
21+
## Requirements
1522

16-
Add this line to your application's Gemfile:
23+
Ruby 3.2 or newer.
1724

18-
```ruby
19-
gem 'busser'
20-
```
21-
22-
And then execute:
25+
## Installation
2326

2427
```bash
25-
bundle
28+
gem install busser
2629
```
2730

28-
Or install it yourself as:
31+
Or add it to your `Gemfile`:
2932

30-
```bash
31-
gem install busser
33+
```ruby
34+
gem "busser"
3235
```
3336

3437
## Usage
3538

36-
Busser is driven by the `busser` command. Run `busser help` (or
37-
`busser help SUBCOMMAND`) for the full option list.
39+
Busser is driven by the `busser` command. Run `busser help`, or
40+
`busser help SUBCOMMAND`, for the full option list.
3841

3942
### Setting up
4043

@@ -44,19 +47,22 @@ Create the Busser home directory, where plugins and suites are installed:
4447
busser setup
4548
```
4649

50+
By default this is `/opt/busser`. Set `BUSSER_ROOT` to put it elsewhere.
51+
4752
### Working with plugins
4853

49-
Test frameworks are added as plugins, each packaged as a `busser-*` gem:
54+
Each test framework is a separate `busser-*` gem:
5055

5156
```bash
5257
busser plugin install busser-bash # install a plugin
58+
busser plugin install busser-bash@0.3.0 # install a specific version
5359
busser plugin list # list installed plugins
5460
busser plugin create junit # scaffold a new plugin
5561
```
5662

5763
### Laying out tests
5864

59-
Each plugin picks up the tests belonging to it, under a directory named after
65+
Each plugin picks up the tests belonging to it, from a directory named after
6066
the plugin inside the suite:
6167

6268
```text
@@ -81,15 +87,12 @@ busser test
8187
busser test bash minitest
8288
```
8389

84-
Busser is normally invoked for you by
85-
[Test Kitchen](https://github.com/test-kitchen/test-kitchen) rather than by
86-
hand -- Test Kitchen installs Busser on the instance under test and runs
87-
`busser test` as part of `kitchen verify`.
88-
8990
## Contributing
9091

91-
1. Fork it
92-
2. Create your feature branch (`git checkout -b my-new-feature`)
93-
3. Commit your changes (`git commit -am 'Add some feature'`)
94-
4. Push to the branch (`git push origin my-new-feature`)
95-
5. Create new Pull Request
92+
Bug reports and pull requests are welcome. See
93+
[CONTRIBUTING.md](CONTRIBUTING.md) for how to set up the project, run the test
94+
suites, and format your commits.
95+
96+
## License
97+
98+
Apache License 2.0. See [LICENSE](LICENSE).

0 commit comments

Comments
 (0)