Skip to content

Commit 2e0b894

Browse files
samples: add samples README (#292)
1 parent 21d0c58 commit 2e0b894

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

samples/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Getting Started with BigQuery Samples
2+
3+
## Running a sample using Cloud Shell
4+
5+
The Google Cloud Shell has application default credentials from its compute instance which will allow you to run an integration test without having to obtain `GOOGLE_APPLICATION_CREDENTIANS`.
6+
7+
However, certain samples require environment variables to be set. For instance, in `CreateDatasetIT.java`:
8+
9+
`private static final String GOOGLE_CLOUD_PROJECT = System.getenv("GOOGLE_CLOUD_PROJECT");` - this sample integration test requires you to specific the [Google Cloud Project](https://cloud.google.com/resource-manager/docs/creating-managing-projects) you would like to run the test in.
10+
11+
Make sure to set environment variables, if necessary, before running the sample, or else you will get an error asking you to set it.
12+
13+
To run a samples integration tests in the cloud shell, simply run the following commands:
14+
15+
`cd samples/snippets` - all samples are located in `java-bigquery/samples/snippets` directory.
16+
17+
`mvn -Dtest=GetTableIT test` - this runs the integration test of `GetTable.java` sample.

0 commit comments

Comments
 (0)