Skip to content

Commit

Permalink
docs: expand getting started guide and add running tests section (#275)
Browse files Browse the repository at this point in the history
I spent the afternoon trying to get the tests running 🥲 These instructions are specific to macOS but I guess better than nothing.
  • Loading branch information
Alan Shaw authored Nov 30, 2020
1 parent 2e70747 commit 8372036
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,47 @@ Build the `sentinel-visor` binary to the root of the project directory:
$ make build
```

Install PostgreSQL:

```sh
brew install postgresql@12
```

Install TimescaleDB:

```sh
brew tap timescale/tap
brew install timescaledb
```

You may need to run the following _before_ installing timescale to get it to compile:

```sh
ln -s /usr/local/Cellar/postgresql@12/12.5/include/postgresql/server /usr/local/Cellar/postgresql@12/12.5/include/server
```

Run `timescaledb-tune` and/or activate TimescaleDB by adding `shared_preload_libraries = 'timescaledb'` to `postgresql.conf`. Ensure you run `timescaledb_move.sh` as homebrew asks to finish the installation and then restart the postgres server if it's running.

### Running tests

Create a new DB in postgres for testing:

```sql
CREATE DATABASE visor_test;
```

Migrate the database to the latest schema:

```sh
visor --db "postgres://username@localhost/visor_test?sslmode=disable" migrate --latest
```

Run the tests:

```sh
VISOR_TEST_DB="postgres://username@localhost/visor_test?sslmode=disable" go test ./...
```

### Usage

```
Expand Down

0 comments on commit 8372036

Please sign in to comment.