Skip to content

Commit

Permalink
Add ulimit increase documentation to CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Firefishy committed Aug 29, 2023
1 parent 530cc48 commit 35fab8a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,47 @@ rbenv is a ruby version manager. rbenv allows projects to use a different versio

> *Note on rbenv: While we recommend using rbenv for managing Ruby versions, it's not strictly necessary. If you have Ruby already installed feel free to use that. If you're not using rbenv, simply omit the `rbenv exec` prefix from the commands below.*
#### **4. Install Required Ruby Version (recommended)**
#### **4. Increase File Limit (Important for MacOS)**

To avoid errors when running tests on MacOS, you might need to increase the number of files your system can open at once. Here's how:

1. Run the command:
```bash
ulimit -n 1024
```
2. To make the change permanent, add the above line to either `~/.zshrc` or `~/.bash_profile`, depending on your shell.

**Note:** MacOS has a low default limit of just 256 open files. If you exceed this while testing, you'll see an error like: `Too many open files - getcwd (Errno::EMFILE)`. This step helps prevent that.

#### **5. Install Required Ruby Version (recommended)**
Navigate to the git checkout of the OpenStreetMap chef repo and run:
```bash
rbenv install
```
This will install the recommended version of ruby for running the tests. The recommended version of ruby is defined in the [.ruby-version](.ruby-version) file.

#### **5. Install Dependencies with Bundler**
#### **6. Install Dependencies with Bundler**
```bash
rbenv exec gem install bundler
rbenv exec bundler install
```
This will install the [bundler](https://bundler.io/), the ruby gem packages manager, and then uses `bundler`` to install the required gem packages for the tests.

#### **6. Run Cookstyle for Linting and Style Checks**
#### **7. Run Cookstyle for Linting and Style Checks**
```bash
rbenv exec bundle exec cookstyle
```
This will run [cookstyle](https://docs.chef.io/workstation/cookstyle/) a linting tool which reports on any linting issues.

> *Automatically run cookstyle lint: We have a sample [git pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) in the `hooks/pre-commit` file which can be copied to the local checkout of this repo to the file `.git/hooks/pre-commit` to ensure the lint passes when running a git commit.*
#### **7. List Available Tests**
#### **8. List Available Tests**
```bash
rbenv exec bundler exec kitchen list
```
This lists the [Test Kitchen](https://kitchen.ci/) tests which are available. The list of tests is generated from the definitions in the [.kitchen.yml](.kitchen.yml) file. The individual tests are written in [InSpec](https://docs.chef.io/inspec/) and are stored in the `test/integration/` directory.

#### **8. Run an Example Test**
#### **9. Run an Example Test**
```bash
rbenv exec bundler exec kitchen test dns-ubuntu-2204
```
Expand Down

0 comments on commit 35fab8a

Please sign in to comment.