Skip to content

Commit

Permalink
Adapt the CONTRIBUTING.md file with the testing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Dec 11, 2024
1 parent 8414e38 commit 145d7ae
Showing 1 changed file with 51 additions and 14 deletions.
65 changes: 51 additions & 14 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,65 @@ Code coverage is monitored for every PR and for the code base as a whole using [

### Running the Tests

There are several ways to run the tests locally:

#### 1. Using Composer Scripts (Recommended)

The simplest way to run tests is using the Composer scripts:

```bash
# Run tests without coverage
composer test

# Run tests with coverage
composer coverage

# Run tests with automatic test server management
composer test:withserver
```

#### 2. Manual Test Environment Management

If you need more control over the test environment, you can manage it manually:

```bash
# Start all test servers and set environment variables
# We need to source the script to properly set environment variables in our shell
source scripts/start-test-environment.sh

# Now run your tests
composer test

# When done, stop all servers
./scripts/stop-test-environment.sh
```

Note: The environment scripts must be sourced (using `source` or `.`) to properly set environment variables in your shell.

#### 3. Individual Component Control

For debugging or development, you might want to manage individual components:

```bash
# Start the test server
# Just the test server
PORT=8080 vendor/bin/start.sh
export "REQUESTS_TEST_HOST_HTTP=localhost:8080"
export REQUESTS_TEST_HOST_HTTP=localhost:8080

# Start the proxy server
# Just the proxy servers
PORT=9002 tests/utils/proxy/start.sh
PORT=9003 AUTH="test:pass" tests/utils/proxy/start.sh
export "REQUESTS_HTTP_PROXY=localhost:9002"
export "REQUESTS_HTTP_PROXY_AUTH=localhost:9003"
export "REQUESTS_HTTP_PROXY_AUTH_USER=test"
export "REQUESTS_HTTP_PROXY_AUTH_PASS=pass"
export REQUESTS_HTTP_PROXY=localhost:9002
export REQUESTS_HTTP_PROXY_AUTH=localhost:9003
export REQUESTS_HTTP_PROXY_AUTH_USER=test
export REQUESTS_HTTP_PROXY_AUTH_PASS=pass
```

# Run the tests
composer test
Remember to stop any servers you start:

# Stop the proxy server
PORT=9002 tests/utils/proxy/stop.sh
```bash
vendor/bin/stop.sh # Stop test server
PORT=9002 tests/utils/proxy/stop.sh # Stop proxy servers
PORT=9003 tests/utils/proxy/stop.sh

# Stop the test server
vendor/bin/stop.sh
```

To run the test with code coverage, use `composer coverage` instead.
Expand Down

0 comments on commit 145d7ae

Please sign in to comment.