Skip to content

Commit 9540611

Browse files
Add scripts/get_unit_test_pkgs.sh.tmpl (#16709) (#11721)
[upstream:4c5ec394e5d087aad69aca8873e6d743e0cc5741] Signed-off-by: Modular Magician <[email protected]>
1 parent a82118a commit 9540611

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

google-beta/services/container/resource_container_cluster_meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ fields:
202202
api_field: 'maintenancePolicy.window.recurringWindow.recurrence'
203203
- field: 'maintenance_policy.recurring_window.start_time'
204204
api_field: 'maintenancePolicy.window.recurringWindow.window.startTime'
205+
- api_field: 'maintenancePolicy.disruptionBudget.lastDisruptionTime'
206+
- api_field: 'maintenancePolicy.disruptionBudget.lastMinorVersionDisruptionTime'
205207
- api_field: 'maintenancePolicy.disruptionBudget.MinorVersionDisruptionInterval'
206208
- api_field: 'maintenancePolicy.disruptionBudget.PatchVersionDisruptionInterval'
207209
- api_field: 'managedOpentelemetryConfig.scope'

google-beta/services/sql/resource_sql_provision_script_meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ api_service_name: 'sqladmin.googleapis.com'
44
api_version: 'v1beta4'
55
#api_resource_type_kind: none. Not associated with any REST resource.
66
fields:
7-
- field: 'name'
7+
- field: 'description'
88
- field: 'script'
99
- field: 'instance'
1010
- field: 'database'

scripts/get_unit_test_pkgs.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# scripts/get_unit_test_pkgs.sh
3+
4+
# Ask Go for BOTH the Import Path and the exact Directory Path on disk, separated by a pipe '|'
5+
go list -e -f '{{.ImportPath}}|{{.Dir}}' ./... | grep -v "/scripts" | while IFS='|' read -r pkg dir; do
6+
7+
# 1. For NON-SERVICE packages:
8+
if [[ "$pkg" != *"/google-beta/services/"* ]]; then
9+
# Check if any file in this directory has a test.
10+
if grep -q "^func Test" "$dir"/*_test.go 2>/dev/null; then
11+
echo "$pkg"
12+
fi
13+
continue
14+
fi
15+
16+
# 2. For SERVICE packages:
17+
# Logic: If line starts with "func Test" AND does NOT start with "func TestAcc", exit with success immediately.
18+
if awk '/^func Test/ && !/^func TestAcc/ { found=1; exit } END { exit !found }' "$dir"/*_test.go 2>/dev/null; then
19+
echo "$pkg"
20+
fi
21+
22+
done

0 commit comments

Comments
 (0)