Skip to content

Commit 589c35d

Browse files
chore: update developer docs for testing (#60)
1 parent 1d1c4de commit 589c35d

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

CONTRIBUTING.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,39 @@ information on using pull requests.
2525
## Community Guidelines
2626

2727
This project follows
28-
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
28+
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
29+
30+
31+
## Running Tests
32+
33+
Bigtable integration tests can either be run against an emulator or a real Bigtable instance.
34+
The target environment can be selected by setting a maven profile. By default it is set to
35+
`bigtable-emulator-it` and other options are `bigtable-prod-it` and `bigtable-directpath-it`.
36+
37+
To use the `bigtable-prod-it` and `bigtable-directpath-it` environments:
38+
39+
1. Set up the target table using scripts/setup-test-table.sh
40+
2. Download the JSON service account credentials file from the Google Developer's Console.
41+
3. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the credentials file
42+
4. Enable the profile and the system properties `bigtable.project`, `bigtable.instance`
43+
and `bigtable.table` to created earlier. Example:
44+
```bash
45+
mvn verify \
46+
-P bigtable-prod-it \
47+
-Dbigtable.project=my-project
48+
-Dbigtable.instance=my-instance
49+
-Dbigtable.table=my-table
50+
```
51+
52+
While developing, it might be helpful to separate running unit tests from integration tests.
53+
54+
```bash
55+
# To skip integration tests:
56+
mvn install -DskipITs
57+
58+
# To skip unit tests
59+
mvn install -DskipUnitTests
60+
61+
# To skip all tests
62+
mvn install -DskipTests
63+
```

google-cloud-bigtable/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
</parent>
1717
<properties>
1818
<site.installationModule>google-cloud-bigtable</site.installationModule>
19+
20+
<!-- Enable the ability to skip unit tests and only run integration tests,
21+
while still respecting global skipTests override. -->
22+
<skipTests>false</skipTests>
23+
<skipUnitTests>${skipTests}</skipUnitTests>
1924
</properties>
2025
<dependencies>
2126
<!-- NOTE: Dependencies are organized into two groups, production and test.
@@ -383,6 +388,8 @@
383388
</dependencies>
384389

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

0 commit comments

Comments
 (0)