Skip to content

Commit

Permalink
docs: describe tests in contribution guide
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Jul 8, 2023
1 parent 7fac4d3 commit fd8d9ae
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 29 deletions.
44 changes: 31 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pull Requests
## Pull Requests

When creating a pull-request you should:

Expand All @@ -8,7 +8,7 @@ When creating a pull-request you should:
- __Update api documentation:__ If your pull-request adding/modifying an API request, make sure you update the swagger documentation (`api-docs.yml`)
- __Run Api Tests:__ If your pull request modifies the API make sure you run the integration tests using dredd.

# Installation in a development environment
## Installation in a development environment

- Check out the `develop` branch
- [Install Go](https://golang.org/doc/install). Go must be >= v1.10 for all the tools we use to work
Expand Down Expand Up @@ -59,14 +59,32 @@ Dredd is used for API integration tests, if you alter the API in any way you mus
matches the responses.

As Dredd and the application database config may differ it expects it's own config.json in the .dredd folder.
The most basic configuration for this using a local docker container to run the database would be
```json
{
"mysql": {
"host": "0.0.0.0:3306",
"user": "semaphore",
"pass": "semaphore",
"name": "semaphore"
}
}
```

### How to run Dredd tests locally

1) Build Dredd hooks:
````bash
task compile:api:hooks
```
2) Install Dredd globally
```bash
npm install -g dredd
```
3) Create `./dredd/config.json` for Dredd. It must contain database connection same as used in Semaphore server.
You can use any supported database dialect for tests. For example BoltDB.
```json
{
"bolt": {
"host": "/tmp/database.boltdb"
},
"dialect": "bolt"
}
```
4) Start Semaphore server (add `--config` option if required):
````bash
./bin/semaphore server
```
5) Start Dredd tests
```
dredd --config ./.dredd/dredd.local.yml
```
29 changes: 13 additions & 16 deletions api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -942,24 +942,21 @@ paths:
responses:
204:
description: User removed
/project/{project_id}/users/{user_id}/admin:
parameters:
- $ref: "#/parameters/project_id"
- $ref: "#/parameters/user_id"
post:
tags:
- project
summary: Makes user admin
responses:
204:
description: User made administrator
delete:
tags:
- project
summary: Revoke admin privileges
put:
parameters:
- name: Project User
in: body
required: true
schema:
type: object
properties:
role:
type: string
example: owner
summary: Update user role
responses:
204:
description: User admin privileges revoked
description: User updated

# project access keys
/project/{project_id}/keys:
Expand Down

0 comments on commit fd8d9ae

Please sign in to comment.