https://github.com/socketry/rack-conform
https://github.com/socketry/rack-conform
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/socketry/rack-conform
- Owner: socketry
- License: mit
- Created: 2022-08-27T07:41:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-02T11:51:02.000Z (over 1 year ago)
- Last Synced: 2024-09-17T03:35:59.593Z (over 1 year ago)
- Language: Ruby
- Size: 74.2 KB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Rack::Conform
Provides rack server conformance testing.
[](https://github.com/socketry/rack-conform/actions?workflow=Test)
## Motivation
Rack has pretty decent support for validating applications do the right thing using `Rack::Lint`. But nothing is really testing that servers behave correctly given a certain response from an application. That's what this test suite is for: to check that servers do the "correct" thing given a specific response from an application.
## Features
- Supports Rack 2 and Rack 3.
### Servers Tested
- Falcon (Rack 2 & 3)
- Puma (Rack 2)
- Passenger (Rack 2)
- Unicorn (Rack 2)
- Thin (Rack 2)
## Usage
This repository includes test suite execution for published versions of major web servers. You can also run it for a specific server.
### Falcon
``` bash
export BUNDLE_GEMFILE=gems/falcon-v0-rack-v3.rb
bundle install
export RACK_CONFORM_SERVER="falcon --bind http://localhost:9292"
export RACK_CONFORM_ENDPOINT="http://localhost:9292"
bundle exec sus # run tests
```
To see more details about the tests being run, use `sus --verbose`.
Falcon can also run tests over `https` using a self-signed certificate and this will cause HTTP/2 to be used.
``` bash
export BUNDLE_GEMFILE=gems/falcon-v0-rack-v3.rb
bundle install
export RACK_CONFORM_SERVER="falcon --bind https://localhost:9292"
export RACK_CONFORM_ENDPOINT="https://localhost:9292"
bundle exec sus # run tests
```
### Puma
``` bash
export BUNDLE_GEMFILE=gems/puma-v6-rack-v3.rb
bundle install
export RACK_CONFORM_SERVER="puma --bind tcp://localhost:9292"
export RACK_CONFORM_ENDPOINT="http://localhost:9292"
bundle exec sus # run tests
```
### Webrick
``` bash
export BUNDLE_GEMFILE="gems/webrick-rack-v3.rb"
bundle install
export RACK_CONFORM_SERVER="rackup -s webrick"
export RACK_CONFORM_ENDPOINT="http://localhost:9292"
bundle exec sus
```
### Starting A Server
You can also start a server running the conform application for independent testing (e.g. using `curl`).
``` bash
export BUNDLE_GEMFILE=gems/falcon-v0-rack-v3.rb
bundle install
export RACK_CONFORM_SERVER="falcon --bind http://localhost:9292"
export RACK_CONFORM_ENDPOINT="http://localhost:9292"
bundle exec bake rack:conform:server
```