Skip to content

Commit

Permalink
docs: update README with docker.setup.script usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnes Lin committed Nov 18, 2019
1 parent c15fd90 commit 2750e01
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions acceptance/repository-cloudant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ Acceptance tests for `@loopback/repository` + `loopback-connector-cloudant`.

### Using own Cloudant instance

If you have a local Cloudant instance listening on `localhost` and the default
port, with a `root` user and an empty password, use the following command:

```bash
npm test
```

If you have a local or remote Cloudant instance and would like to use that to
run the test suite, use the following command:

Expand All @@ -25,6 +18,7 @@ CLOUDANT_URL=<URL> CLOUDANT_HOST=<HOST> CLOUDANT_PORT=<PORT> CLOUDANT_USER=<USER
**Windows**

```bash
SET CLOUDANT_URL=<URL>
SET CLOUDANT_HOST=<HOST>
SET CLOUDANT_PORT=<PORT>
SET CLOUDANT_USER=<USER>
Expand All @@ -45,27 +39,25 @@ same (except couchDB doesn't support geosearch).

- Install [Docker](https://docs.docker.com/engine/installation/).

- Use the `couchDB3:latest` image, and rename the container as
`cloudant-testdb`.

- Start the container, and create an admin and password for this image at
`http://localhost:{YOURPORT}/_utils/` if it doesn't have any yet.

- Then run the following script
- Run the following script

```bash
source setup.sh <HOST> <PORT> <USER> <PASSWORD> <DATABASE>
CLOUDANT_USER=<USER> CLOUDANT_PASSWORD=<PASSWORD> CLOUDANT_DATABASE=<DATABASE> node docker.setup.sh
```

Where `<HOST>`, `<PORT>`, `<USER>`, `<PASSWORD>` and `<DATABASE>` are optional
parameters. The default values are `localhost`, `8080`, `admin`, `pass` and
`testdb` respectively.
This script will create a couchDB3 container and also set the admin/password for
you automatically.

- The script `cloudant-config.sh` is generated by the above script. It has all
needed environment variables. Run the following command to test out your code

- Run the test:
```bash
source cloudant-config.sh && npm test
```

```bash
npm test
```
Those environment variables need to be exported to run the test. Or you have to
change them manually in `./src/__test__/cloudant.datasource.ts` file based on
the response you get from running the script `docker.setup.sh`.

## Contributors

Expand Down

0 comments on commit 2750e01

Please sign in to comment.