Skip to content

Commit b723ba5

Browse files
authored
ci(workflow): re-enable XVR GoUsingJava Dataflow tests (#35953)
* ci(workflow): re-enable XVR GoUsingJava Dataflow tests fix(integration): improve expansion service startup verification with retry logic refactor(gradle): re-enable GoUsingJava tests after fixing underlying issues fix(script): add docker daemon health check and auto-start in validatesrunner tests * ci(workflow): update trigger paths for XVR GoUsingJava Dataflow test Add 'release/trigger_all_tests.json' to trigger paths for pull_request_target event * test(integration): add test mode flag to skip connectivity checks Add testMode flag to ExpansionServices struct to differentiate between test and production environments. In test mode, skip the connectivity checks and use simple wait time to improve test reliability with mock processes. * ci: add trigger file for beam PostCommit XVR GoUsingJava Dataflow test suite * trigger more tests
1 parent f2b38cd commit b723ba5

File tree

8 files changed

+72
-10
lines changed

8 files changed

+72
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"modification": 4
2+
"modification": 5
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"modification": 1
2+
"modification": 2
33
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"comment": "Modify this file in a trivial way to cause this test suite to run",
3+
"modification": 1
4+
}

.github/workflows/beam_PostCommit_XVR_GoUsingJava_Dataflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
# TODO(https://github.com/apache/beam/issues/32492): re-enable the suite
1717
# on cron and add release/trigger_all_tests.json to trigger path once fixed.
1818

19-
name: PostCommit XVR GoUsingJava Dataflow (DISABLED)
19+
name: PostCommit XVR GoUsingJava Dataflow
2020

2121
on:
22-
# schedule:
23-
# - cron: '45 5/6 * * *'
22+
schedule:
23+
- cron: '45 5/6 * * *'
2424
pull_request_target:
25-
paths: ['.github/trigger_files/beam_PostCommit_XVR_GoUsingJava_Dataflow.json']
25+
paths: ['.github/trigger_files/beam_PostCommit_XVR_GoUsingJava_Dataflow.json', 'release/trigger_all_tests.json']
2626
workflow_dispatch:
2727

2828
#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,8 +2904,9 @@ class BeamModulePlugin implements Plugin<Project> {
29042904
// CrossLanguageValidatesRunnerTask is setup under python sdk but also runs tasks not involving
29052905
// python versions. set 'skipNonPythonTask' property to avoid duplicated run of these tasks.
29062906
if (!(project.hasProperty('skipNonPythonTask') && project.skipNonPythonTask == 'true')) {
2907-
System.err.println 'GoUsingJava tests have been disabled: https://github.com/apache/beam/issues/30517#issuecomment-2341881604.'
2908-
// mainTask.configure { dependsOn goTask }
2907+
// Re-enabled GoUsingJava tests after fixing underlying issues
2908+
// Previous issues: Docker daemon connectivity, SDK worker communication, timeout configurations
2909+
mainTask.configure { dependsOn goTask }
29092910
}
29102911
cleanupTask.configure { mustRunAfter goTask }
29112912
config.cleanupJobServer.configure { mustRunAfter goTask }

sdks/go/test/integration/expansions.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package integration
1717

1818
import (
1919
"fmt"
20+
"net"
2021
"strconv"
2122
"time"
2223

@@ -57,6 +58,7 @@ type ExpansionServices struct {
5758
// Callback for running jars, stored this way for testing purposes.
5859
run func(time.Duration, string, ...string) (jars.Process, error)
5960
waitTime time.Duration // Time to sleep after running jar. Tests can adjust this.
61+
testMode bool // Skip connectivity checks when in test mode
6062
}
6163

6264
// NewExpansionServices creates and initializes an ExpansionServices instance.
@@ -67,6 +69,7 @@ func NewExpansionServices() *ExpansionServices {
6769
procs: make([]jars.Process, 0),
6870
run: jars.Run,
6971
waitTime: 3 * time.Second,
72+
testMode: false,
7073
}
7174
}
7275

@@ -100,9 +103,33 @@ func (es *ExpansionServices) GetAddr(label string) (string, error) {
100103
if err != nil {
101104
return "", fmt.Errorf("cannot run jar for expansion service labeled \"%s\": %w", label, err)
102105
}
103-
time.Sleep(es.waitTime) // Wait a bit for the jar to start.
104-
es.procs = append(es.procs, proc)
106+
105107
addr := "localhost:" + portStr
108+
109+
// Use different wait strategies for test mode vs production
110+
if es.testMode {
111+
// In test mode, use simple wait time for compatibility with mock processes
112+
time.Sleep(es.waitTime)
113+
} else {
114+
// In production, wait for the jar to start with improved retry logic
115+
maxRetries := 30
116+
retryDelay := time.Second
117+
118+
for i := 0; i < maxRetries; i++ {
119+
time.Sleep(retryDelay)
120+
// Try to connect to the expansion service to verify it's ready
121+
conn, err := net.DialTimeout("tcp", addr, 2*time.Second)
122+
if err == nil {
123+
conn.Close()
124+
break
125+
}
126+
if i == maxRetries-1 {
127+
return "", fmt.Errorf("expansion service labeled \"%s\" failed to start after %d retries: %w", label, maxRetries, err)
128+
}
129+
}
130+
}
131+
132+
es.procs = append(es.procs, proc)
106133
es.addrs[label] = addr
107134
return addr, nil
108135
}

sdks/go/test/integration/expansions_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func TestExpansionServices_GetAddr_Addresses(t *testing.T) {
6363
procs: make([]jars.Process, 0),
6464
run: failRun,
6565
waitTime: 0,
66+
testMode: true,
6667
}
6768

6869
// Ensure we get the same map we put in, and that addresses take priority over jars if
@@ -97,6 +98,7 @@ func TestExpansionServices_GetAddr_Jars(t *testing.T) {
9798
procs: make([]jars.Process, 0),
9899
run: succeedRun,
99100
waitTime: 0,
101+
testMode: true,
100102
}
101103

102104
// Call GetAddr on each jar twice, checking that the addresses remain consistent.
@@ -151,6 +153,7 @@ func TestExpansionServices_Shutdown(t *testing.T) {
151153
procs: make([]jars.Process, 0),
152154
run: succeedRun,
153155
waitTime: 0,
156+
testMode: true,
154157
}
155158
// Call getAddr on each label to run jars.
156159
for label := range addrsMap {

sdks/go/test/run_validatesrunner_tests.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,33 @@ fi
351351
if [[ "$RUNNER" == "dataflow" ]]; then
352352
# Verify docker and gcloud commands exist
353353
command -v docker
354+
# Check if Docker daemon is running
355+
if ! docker info >/dev/null 2>&1; then
356+
echo "Warning: Docker daemon is not running. Starting Docker..."
357+
# Try to start Docker daemon (this may require sudo on some systems)
358+
if command -v systemctl >/dev/null 2>&1; then
359+
sudo systemctl start docker || echo "Failed to start Docker daemon via systemctl"
360+
elif command -v service >/dev/null 2>&1; then
361+
sudo service docker start || echo "Failed to start Docker daemon via service"
362+
else
363+
echo "Please start Docker daemon manually"
364+
exit 1
365+
fi
366+
# Wait for Docker daemon to be ready
367+
for i in {1..30}; do
368+
if docker info >/dev/null 2>&1; then
369+
echo "Docker daemon is now running"
370+
break
371+
fi
372+
echo "Waiting for Docker daemon to start... ($i/30)"
373+
sleep 2
374+
done
375+
# Final check
376+
if ! docker info >/dev/null 2>&1; then
377+
echo "Error: Docker daemon failed to start. Please start it manually."
378+
exit 1
379+
fi
380+
fi
354381
docker -v
355382
command -v gcloud
356383
gcloud --version

0 commit comments

Comments
 (0)