Skip to content

Commit dffcd62

Browse files
committed
chore: add golden file tests for release note generator
Adds unit tests that compare the script output against saved golden files: - Root generation for monorepo version 1.85.0. - Module generation for java-run at version 0.71.0.
1 parent c21db4d commit dffcd62

3 files changed

Lines changed: 119 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import subprocess
2+
import unittest
3+
from pathlib import Path
4+
5+
6+
class TestGenerateModuleNotes(unittest.TestCase):
7+
8+
def setUp(self):
9+
self.script_path = Path(
10+
".github/release-note-generation/generate_module_notes.py"
11+
)
12+
self.testdata_dir = Path(".github/release-note-generation/testdata")
13+
14+
def test_java_run_generation(self):
15+
golden_file = self.testdata_dir / "golden_java-run_0.71.0.txt"
16+
with open(golden_file, "r") as f:
17+
expected_output = f.read()
18+
19+
cmd = [
20+
"python3",
21+
str(self.script_path),
22+
"--module",
23+
"google-cloud-run",
24+
"--directory",
25+
"java-run",
26+
"--version",
27+
"0.71.0",
28+
"--short-name",
29+
"run",
30+
]
31+
result = subprocess.run(
32+
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
33+
)
34+
35+
self.assertEqual(result.returncode, 0)
36+
self.assertEqual(result.stdout, expected_output)
37+
38+
def test_root_generation(self):
39+
golden_file = self.testdata_dir / "golden_root_1.85.0.txt"
40+
with open(golden_file, "r") as f:
41+
expected_output = f.read()
42+
43+
cmd = [
44+
"python3",
45+
str(self.script_path),
46+
"--module",
47+
"google-cloud-java",
48+
"--directory",
49+
".",
50+
"--version",
51+
"1.85.0",
52+
]
53+
result = subprocess.run(
54+
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
55+
)
56+
57+
self.assertEqual(result.returncode, 0)
58+
self.assertEqual(result.stdout, expected_output)
59+
60+
61+
if __name__ == "__main__":
62+
unittest.main()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
Release Notes:
3+
### ⚠ BREAKING CHANGES
4+
5+
* 9f28cd5bcd9 fix!: [run] An existing resource_definition `cloudbuild.googleapis.com/WorkerPool` is removed
6+
* 9f28cd5bcd9 fix!: [run] A type of an existing resource_reference option of the field `worker_pool` in message `.google.cloud.run.v2.SubmitBuildRequest` is changed from `cloudbuild.googleapis.com/WorkerPool` to `cloudbuild.googleapis.com/BuildWorkerPool`
7+
* 9f28cd5bcd9 fix!: [run] A type of an existing resource_reference option of the field `worker_pool` in message `.google.cloud.run.v2.BuildConfig` is changed from `cloudbuild.googleapis.com/WorkerPool` to `cloudbuild.googleapis.com/BuildWorkerPool`
8+
9+
### Features
10+
11+
* 9f28cd5bcd9 feat: [run] Adding new resource tpye run.googleapis.com/WorkerPool. [googleapis/googleapis@0998e04](https://github.com/googleapis/googleapis/commit/0998e045cf83a1307ceb158e3da304bdaff5bb3a)
12+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
Release Notes:
3+
### Features
4+
5+
* fc62b1e80fa feat: [chronicle] Add DataTableService to Chronicle v1 Client Libraries [googleapis/googleapis@e182cf5](https://github.com/googleapis/googleapis/commit/e182cf5152967047b763fd88f03094cfc836d194)
6+
* fc62b1e80fa feat: [vectorsearch] Added CMEK support
7+
* fc62b1e80fa feat: [vectorsearch] Added UpdateIndex support
8+
* fc62b1e80fa feat: [discoveryengine] add AUTO condition to SearchAsYouTypeSpec in v1alpha and v1beta [googleapis/googleapis@f01ba6b](https://github.com/googleapis/googleapis/commit/f01ba6bda9ef3a45069a699767ee7dc46f30028a)
9+
* fc62b1e80fa feat: [kms] support external-μ in the Digest [googleapis/googleapis@7fbf256](https://github.com/googleapis/googleapis/commit/7fbf256c9ee4e580bc2ffa825d8d41263d9462d3)
10+
* fc62b1e80fa feat: [kms] add a variable to SingleTenantHsmInstanceCreate to control whether future key portability features will be usable on the instance [googleapis/googleapis@bc600b8](https://github.com/googleapis/googleapis/commit/bc600b8b72913d10eaf1793a0845643fda94e4eb)
11+
* fc62b1e80fa feat: [databasecenter] Add support for BigQuery datasets and reservations
12+
* fc62b1e80fa feat: [databasecenter] Introduce resource affiliation and lineage tracking
13+
* fc62b1e80fa feat: [databasecenter] Enhance maintenance information with state, upcoming maintenance, and failure reasons [googleapis/googleapis@7f9e9ff](https://github.com/googleapis/googleapis/commit/7f9e9ff15720fac72c4ba3212343ba6e6102c920)
14+
* fc62b1e80fa feat: [shopping-merchant-inventories] a new field `base64_encoded_name` is added to the `LocalInventory` message
15+
* fc62b1e80fa feat: [shopping-merchant-inventories] new field `base64_encoded_name` is added to the `RegionalInventory` message [googleapis/googleapis@6db5d2e](https://github.com/googleapis/googleapis/commit/6db5d2e6bc3a762fccebbcbcfb8681a6ebaf008e)
16+
* fc62b1e80fa feat: [dataplex] Allow Data Documentation DataScans to support BigQuery Dataset resources in addition to BigQuery table resources
17+
* fc62b1e80fa feat: [dataproc] Add `Engine` field to support LightningEngine in clusters and add support for stop ttl [googleapis/googleapis@2da8658](https://github.com/googleapis/googleapis/commit/2da86587126416eb48d561cd800bb03afa2f501a)
18+
* fc62b1e80fa feat: [shopping-merchant-products] a new field `base64_encoded_name` is added to the `Product` message
19+
* fc62b1e80fa feat: [shopping-merchant-products] new fields - `base64_encoded_name` and `base64_encoded_product` added to the `ProductInput` message
20+
* fc62b1e80fa feat: [infra-manager] adding DeploymentGroups, you can now manage deployment of multiple module root dependencies in a single DAG [googleapis/googleapis@f5cb7af](https://github.com/googleapis/googleapis/commit/f5cb7afc40b63d52f43bc306cb9b64a87b681aea)
21+
* 050187d934f feat: [appoptimize] new module for appoptimize (#12768)
22+
23+
### Bug Fixes
24+
25+
* 4bed8fd118a fix(datastore): Create a plaintext gRPC transport channel when using the Emulator (#12721)
26+
* 8e6ba3662d3 fix: correct build directory paths in graalvm cloudbuild.yaml (#12794)
27+
* ac69c8d9041 fix(bqjdbc): Revert DatabaseMetaData field to be non-static in BigQueryConnection (#12778)
28+
* 80dfac6773b fix: update appoptimize version to 0.0.1 to match released repo (#12782)
29+
* fc62b1e80fa fix(deps): update the Java code generator (gapic-generator-java) to 2.69.0
30+
* 72e5508669e fix(bqjdbc): lazily instantiate Statement in BigQueryDatabaseMetaData (#12752)
31+
* bf926fb23a0 fix(gdch): support EC private keys (#1896)
32+
* 30088d21401 fix(auth): Address ClientSideCredentialAccessBoundary RefreshTask race condition (#12681)
33+
34+
### Documentation
35+
36+
* fc62b1e80fa docs: [vectorsearch] Updated documentation for listing locations
37+
* fc62b1e80fa docs: [vectorsearch] Updated documentation for Collection.data_schema [googleapis/googleapis@8d0f6d8](https://github.com/googleapis/googleapis/commit/8d0f6d8615c72d1907aeec8984d68df50fb6b697)
38+
* fc62b1e80fa docs: [shopping-merchant-inventories] A comment for field `name` in message `.google.shopping.merchant.products.v1.LocalInventory` is changed
39+
* fc62b1e80fa docs: [shopping-merchant-inventories] A comment for field `name` in message `.google.shopping.merchant.products.v1.RegionalInventory` is changed
40+
* fc62b1e80fa docs: [dataplex] A comment for message `DataDocumentationResult` is changed
41+
* fc62b1e80fa docs: [dataplex] A comment for field `table_result` in message `.google.cloud.dataplex.v1.DataDocumentationResult` is changed [googleapis/googleapis@1991351](https://github.com/googleapis/googleapis/commit/19913519dae24b82f58b8f1b43822c2c020a123c)
42+
* fc62b1e80fa docs: [network-management] Update comment for the `region` field in `RouteInfo` [googleapis/googleapis@66fcc02](https://github.com/googleapis/googleapis/commit/66fcc021fec9e5249e69da17068bea999f113622) chore: [dialogflow-cx] Add ruby_package to missing proto files in google-cloud-dialogflow-cx-v3 [googleapis/googleapis@b6669d7](https://github.com/googleapis/googleapis/commit/b6669d761c84c04682270ae5610106eb81ce1706)
43+
* fc62b1e80fa docs: [shopping-merchant-products] A comment for field `name` in message `.google.shopping.merchant.products.v1.ProductInput` is changed
44+
* fc62b1e80fa docs: [shopping-merchant-products] A comment for field `name` in message `.google.shopping.merchant.products.v1.Product` is changed [googleapis/googleapis@2aba484](https://github.com/googleapis/googleapis/commit/2aba48492ae471bfb717f5e9c5a190b7cc1c6636)
45+

0 commit comments

Comments
 (0)