Skip to content

Commit

Permalink
test(repository-tests): create README and local test setup files for …
Browse files Browse the repository at this point in the history
…acceptance-cloudant
  • Loading branch information
Agnes Lin committed Nov 13, 2019
1 parent 4532510 commit 7f9e923
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
31 changes: 21 additions & 10 deletions acceptance/repository-cloudant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,30 @@ npm test
### Using Docker (Linux, MacOS, WSL)

If you do not have a local Cloudant instance, you can also run the test suite
with very minimal requirements.
with very minimal requirements. We use couchDB docker image to run the test
locally.

- Assuming you have [Docker](https://docs.docker.com/engine/installation/)
installed, run the following script which would spawn a Cloudant instance on
your local:
NOTICE: we use `couchDB3` docker image for testing Cloudant because Cloudant
doesn't have a maintained image, and most of the their functionalities are the
same (except couchDB doesn't support geosearch).

```bash
source setup.sh <URL> <HOST> <PORT> <USER> <PASSWORD> <DATABASE>
```
- 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

```bash
source setup.sh <HOST> <PORT> <USER> <PASSWORD> <DATABASE>
```

Where `<URL>`, `<HOST>`, `<PORT>`, `<USER>`, `<PASSWORD>` and `<DATABASE>` are
optional parameters. The default values are `url`, `localhost`, `3306`,
`root`, `pass` and `testdb` respectively.
Where `<HOST>`, `<PORT>`, `<USER>`, `<PASSWORD>` and `<DATABASE>` are optional
parameters. The default values are `localhost`, `8080`, `admin`, `pass` and
`testdb` respectively.

- Run the test:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import { CrudFeatures, DataSourceOptions } from '@loopback/repository-tests';
import {CrudFeatures, DataSourceOptions} from '@loopback/repository-tests';

const connector = require('loopback-connector-cloudant');

export const CLOUDANT_CONFIG: DataSourceOptions = {
connector,
host: process.env.CLOUDANT_HOST || 'localhost',
port: process.env.CLOUDANT_PORT || 5984,
port: process.env.CLOUDANT_PORT || 8080,
username: process.env.CLOUDANT_USER || 'admin',
password: process.env.CLOUDANT_PASSWORD || 'pass',
database: process.env.CLOUDANT_DATABASE || 'testdb',
url: process.env.CLOUDANT_URL || 'http://admin:pass@localhost:5984',
};

export const CLOUDANT_FEATURES: Partial<CrudFeatures> = {
Expand Down

0 comments on commit 7f9e923

Please sign in to comment.