jrmccluskey commented on a change in pull request #16470:
URL: https://github.com/apache/beam/pull/16470#discussion_r781386046
##########
File path: sdks/go/pkg/beam/core/runtime/xlangx/expansionx/process_test.go
##########
@@ -22,15 +22,28 @@ import (
"testing"
)
+func TestFindOpenPort(t *testing.T) {
+ port, err := findOpenPort()
+ if err != nil {
+ t.Fatalf("failed to find open port, got %v", port)
+ }
+ if port < 1 || port > 65535 {
+ t.Errorf("port out of TCP range [1, 66535], got %d", port)
+ }
+}
+
func TestNewExpansionServiceRunner(t *testing.T) {
testPath := "path/to/jar"
testPort := "8097"
- serviceRunner := NewExpansionServiceRunner(testPath, testPort)
+ serviceRunner, err := NewExpansionServiceRunner(testPath, testPort)
+ if err != nil {
+ t.Fatalf("NewExpansionServiceRunner failed, got %v", err)
+ }
if serviceRunner.jarPath != testPath {
t.Errorf("JAR path mismatch: wanted %v, got %v", testPath,
serviceRunner.jarPath)
}
if serviceRunner.servicePort != testPort {
- t.Errorf("service port mismatch: wanted %v, got %v", testPort,
serviceRunner.servicePort)
+ t.Errorf("service port mismatch: wanted %v, got %v", testPort,
testPort)
Review comment:
Changed.
##########
File path: sdks/go/pkg/beam/core/runtime/xlangx/expansionx/process_test.go
##########
@@ -44,19 +57,38 @@ func TestNewExpansionServiceRunner(t *testing.T) {
}
}
+func TestGetPort(t *testing.T) {
+ testPort := "8097"
+ serviceRunner, err := NewExpansionServiceRunner("", testPort)
+ if err != nil {
+ t.Fatalf("NewExpansionServiceRunner failed, got %v", err)
+ }
+ observedPort := serviceRunner.GetPort()
+ expPort := "localhost:" + testPort
+ if observedPort != expPort {
+ t.Errorf("GetPort() returned mismatched value: wanted %v, got
%v", observedPort, expPort)
Review comment:
Fixed, that makes sense
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]