Skip to content

Commit

Permalink
chore: update developer docs for testing (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbernstein2 committed Nov 4, 2019
1 parent 1d1c4de commit 589c35d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
37 changes: 36 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -25,4 +25,39 @@ information on using pull requests.
## Community Guidelines

This project follows
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).


## Running Tests

Bigtable integration tests can either be run against an emulator or a real Bigtable instance.
The target environment can be selected by setting a maven profile. By default it is set to
`bigtable-emulator-it` and other options are `bigtable-prod-it` and `bigtable-directpath-it`.

To use the `bigtable-prod-it` and `bigtable-directpath-it` environments:

1. Set up the target table using scripts/setup-test-table.sh
2. Download the JSON service account credentials file from the Google Developer's Console.
3. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the credentials file
4. Enable the profile and the system properties `bigtable.project`, `bigtable.instance`
and `bigtable.table` to created earlier. Example:
```bash
mvn verify \
-P bigtable-prod-it \
-Dbigtable.project=my-project
-Dbigtable.instance=my-instance
-Dbigtable.table=my-table
```

While developing, it might be helpful to separate running unit tests from integration tests.

```bash
# To skip integration tests:
mvn install -DskipITs

# To skip unit tests
mvn install -DskipUnitTests

# To skip all tests
mvn install -DskipTests
```
7 changes: 7 additions & 0 deletions google-cloud-bigtable/pom.xml
Expand Up @@ -16,6 +16,11 @@
</parent>
<properties>
<site.installationModule>google-cloud-bigtable</site.installationModule>

<!-- Enable the ability to skip unit tests and only run integration tests,
while still respecting global skipTests override. -->
<skipTests>false</skipTests>
<skipUnitTests>${skipTests}</skipUnitTests>
</properties>
<dependencies>
<!-- NOTE: Dependencies are organized into two groups, production and test.
Expand Down Expand Up @@ -383,6 +388,8 @@
</dependencies>

<configuration>
<!-- enable the ability to skip unit tests, while running integration tests -->
<skipTests>${skipUnitTests}</skipTests>
<!--
TODO(igorbernstein): enable parallel tests once the generate client tests use unique
names for the mock server
Expand Down
File renamed without changes.

0 comments on commit 589c35d

Please sign in to comment.