You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(gcloud)!: add support to seed data when using RunBigQueryContainer (#2523)
* Update bigquery container to have an optional seed yaml file
* update opts snippet to handle error; update documentation
* Update based on feedback
* chore: use new API for running big query container
* chore: run make lint
* chore: use testify's require
* chore: remove unused
* fix: process yaml file just once
* chore: rename variable
* chore: run mod tidy
* chore: pass a reader to WithDataYAML option
* chore: do not allow multiple calls to WithDataYAML
* chore: embed test resource
* chore: simplify reader
* fix: update docs
* chore: use the embed file even more
* docs: wording
* chore: simplify tests
* chore: use original assertion
---------
Co-authored-by: Manuel de la Peña <[email protected]>
Copy file name to clipboardExpand all lines: docs/modules/gcloud.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ go get github.com/testcontainers/testcontainers-go/modules/gcloud
17
17
## Usage example
18
18
19
19
!!!info
20
-
By default, the all the emulators use `gcr.io/google.com/cloudsdktool/cloud-sdk:367.0.0-emulators` as the default Docker image, except for the BigQuery emulator, which uses `ghcr.io/goccy/bigquery-emulator:0.4.3`, and Spanner, which uses `gcr.io/cloud-spanner-emulator/emulator:1.4.0`.
20
+
By default, the all the emulators use `gcr.io/google.com/cloudsdktool/cloud-sdk:367.0.0-emulators` as the default Docker image, except for the BigQuery emulator, which uses `ghcr.io/goccy/bigquery-emulator:0.6.1`, and Spanner, which uses `gcr.io/cloud-spanner-emulator/emulator:1.4.0`.
21
21
22
22
### BigQuery
23
23
@@ -28,6 +28,22 @@ go get github.com/testcontainers/testcontainers-go/modules/gcloud
28
28
29
29
It's important to set the `option.WithEndpoint()` option using the container's URI, as shown in the client example above.
30
30
31
+
#### Data YAML (Seed File)
32
+
33
+
- Not available until the next release of testcontainers-go <ahref="https://github.com/testcontainers/testcontainers-go"><spanclass="tc-version">:material-tag: main</span></a>
34
+
35
+
If you would like to do additional initialization in the BigQuery container, add a `data.yaml` file represented by an `io.Reader` to the container request with the `WithDataYAML` function.
36
+
That file is copied after the container is created but before it's started. The startup command then used will look like `--project test --data-from-yaml /testcontainers-data.yaml`.
37
+
38
+
An example of a `data.yaml` file that seeds the BigQuery instance with datasets and tables is shown below:
0 commit comments