Skip to content

Commit ea627b0

Browse files
feat(Spanner): Add workflow dispatch options to run specific test suites or individual tests within Spanner PR
1 parent 18949a0 commit ea627b0

File tree

8 files changed

+36
-5
lines changed

8 files changed

+36
-5
lines changed

.github/workflows/spanner-load-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ on:
2121
# at 02:00 weekly on every Tuesday.
2222
- cron: '0 2 * * 2'
2323
workflow_dispatch:
24+
inputs:
25+
specific_test:
26+
description: 'Specific Integration Test (passed to -Dtest=)'
27+
required: false
28+
type: string
2429

2530
permissions: write-all
2631

@@ -102,7 +107,8 @@ jobs:
102107
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
103108
--lt-export-project="cloud-teleport-testing" \
104109
--lt-export-dataset="performance_tests" \
105-
--lt-export-table="template_performance_metrics"
110+
--lt-export-table="template_performance_metrics" \
111+
--test="${{ github.event.inputs.specific_test }}"
106112
- name: Upload Load Test Observer Report
107113
uses: actions/upload-artifact@v6
108114
if: always() # always run even if the previous step fails

.github/workflows/spanner-pr.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ on:
4343
schedule:
4444
- cron: "3 */12 * * *"
4545
workflow_dispatch:
46+
inputs:
47+
specific_test:
48+
description: 'Specific Integration Test (passed to -Dtest=)'
49+
required: false
50+
type: string
4651

4752
concurrency:
4853
group: ${{ github.workflow }}-${{ github.ref }}
@@ -184,7 +189,8 @@ jobs:
184189
--it-project="span-cloud-teleport-testing" \
185190
--it-artifact-bucket="span-cloud-teleport-testing-it-gitactions" \
186191
--it-private-connectivity="datastream-connect-2" \
187-
--it-cloud-proxy-host="10.128.0.16"
192+
--it-cloud-proxy-host="10.128.0.16" \
193+
--test="${{ github.event.inputs.specific_test }}"
188194
- name: Upload Integration Tests Report
189195
uses: actions/upload-artifact@v6
190196
if: always() # always run even if the previous step fails

cicd/cmd/run-it-smoke-tests/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ func main() {
7272
flags.CloudProxyHost(),
7373
flags.CloudProxyMySqlPort(),
7474
flags.CloudProxyPostgresPort(),
75-
flags.CloudProxyPassword())
75+
flags.CloudProxyPassword(),
76+
mvnFlags.SpecificTest(flags.TestToRun()))
7677
if err != nil {
7778
log.Fatalf("%v\n", err)
7879
}

cicd/cmd/run-it-tests/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func main() {
7575
flags.CloudProxyPostgresPort(),
7676
flags.CloudProxyPassword(),
7777
flags.UnifiedWorkerHarnessContainerImage(),
78-
flags.CloudProxyPassword())
78+
flags.CloudProxyPassword(),
79+
mvnFlags.SpecificTest(flags.TestToRun()))
7980
if err != nil {
8081
log.Fatalf("%v\n", err)
8182
}

cicd/cmd/run-load-tests/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ func main() {
7474
flags.CloudProxyHost(),
7575
flags.CloudProxyMySqlPort(),
7676
flags.CloudProxyPostgresPort(),
77-
flags.CloudProxyPassword())
77+
flags.CloudProxyPassword(),
78+
mvnFlags.SpecificTest(flags.TestToRun()))
7879
if err != nil {
7980
log.Fatalf("%v\n", err)
8081
}

cicd/cmd/run-unit-tests/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func main() {
3939
mvnFlags.SkipIntegrationTests(),
4040
mvnFlags.FailAtTheEnd(),
4141
mvnFlags.ThreadCount(8),
42+
mvnFlags.SpecificTest(flags.TestToRun()),
4243
mvnFlags.InternalMaven())
4344
if err != nil {
4445
log.Fatalf("%v\n", err)

cicd/internal/flags/common-flags.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
// Avoid making these vars public.
3535
var (
3636
modulesToBuild string
37+
testToRun string
3738
moduleMap = map[string][]string{
3839
ALL: {},
3940
DEFAULT: {},
@@ -76,6 +77,7 @@ var (
7677
// Registers all common flags. Must be called before flag.Parse().
7778
func RegisterCommonFlags() {
7879
flag.StringVar(&modulesToBuild, "modules-to-build", ALL, "List of modules to build/run commands against")
80+
flag.StringVar(&testToRun, "test", "", "Specific test to run")
7981
}
8082

8183
// Returns all modules to build.
@@ -102,3 +104,8 @@ func ModulesToBuild() []string {
102104
}
103105
return strings.Split(m, ",")
104106
}
107+
108+
// Returns the specific test to run.
109+
func TestToRun() string {
110+
return testToRun
111+
}

cicd/internal/workflows/maven-workflows.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type MavenFlags interface {
6161
StaticSpannerInstance(string) string
6262
SpannerHost(string) string
6363
InternalMaven() string
64+
SpecificTest(string) string
6465
}
6566

6667
type mvnFlags struct{}
@@ -163,6 +164,13 @@ func (*mvnFlags) InternalMaven() string {
163164
return "--settings=.mvn/settings.xml"
164165
}
165166

167+
func (*mvnFlags) SpecificTest(test string) string {
168+
if test == "" {
169+
return ""
170+
}
171+
return "-Dtest=" + test
172+
}
173+
166174
func NewMavenFlags() MavenFlags {
167175
return &mvnFlags{}
168176
}

0 commit comments

Comments
 (0)