You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/02/19 01:33:37 UTC

[GitHub] [beam] youngoli opened a new pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

youngoli opened a new pull request #16908:
URL: https://github.com/apache/beam/pull/16908


   Adds functionality for running jars to the Go integration test framework, and uses this functionality to implement handling of K:V flags for providing expansion service jars and addresses to the test framework. This means that tests can simply get the address of an expansion service with the appropriate label, and this feature will handle running a jar if necessary, or just using the passed in endpoint otherwise.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [x] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [x] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [x] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/validate-runner/README.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] lostluck commented on a change in pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #16908:
URL: https://github.com/apache/beam/pull/16908#discussion_r814389427



##########
File path: sdks/go/test/integration/internal/jars/jars.go
##########
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package jars contains functionality for running jars for integration tests. The main entry point
+// for running a jar is the Run function. The Process interface is used to interact with the running
+// jars, and most importantly for shutting down the jars once finished with them.
+package jars
+
+import (
+	"fmt"
+	"os/exec"
+)
+
+type runCallback func(duration, jar string, args ...string) (Process, error)
+
+var runner runCallback // Saves which behavior to use when Run is called.
+
+func init() {
+	runner = getRunner()
+}
+
+// getRunner is used to determine the appropriate behavior for run during initialization time,
+// based on the OS and installed binaries of the system. This is returned as a runCallback which
+// can be called whenever Run is called. If an error prevents Run from being used at all (for
+// example, Java is not installed), then the runCallback will return that error.
+func getRunner() runCallback {
+	// First check if we can even run jars.
+	_, err := exec.LookPath("java")
+	if err != nil {
+		err := fmt.Errorf("cannot run jar: 'java' command not installed: %w", err)
+		return func(_, _ string, _ ...string) (Process, error) {
+			return nil, err
+		}
+	}
+
+	// Defer to OS-specific logic for checking for presence of timeout command.
+	return getTimeoutRunner()
+}
+
+// Run runs a jar given an optional duration, a path to the jar, and any desired arguments to the
+// jar. It returns a Process object which can be used to shut down the jar once finished.
+//
+// The duration parameter is a duration for the timeout command which can be used to automatically
+// kill the jar after a set duration, in order to avoid resource leakage. It is described here:
+// https://man7.org/linux/man-pages/man1/timeout.1.html. If a duration is provided but the system
+// is unable to use the timeout command, this function will return an error. To indicate that a
+// duration isn't needed, pass in an empty string.
+func Run(duration, jar string, args ...string) (Process, error) {

Review comment:
       I don't love the string "duration" field. Consider accepting a `time.Duration` instead and handling the format conversion. 
   
   `time.Duration` even has a `Seconds` method which returns the duration, in seconds, in floating value, which you can then simply `fmt.Sprintf("%fs")`
   https://pkg.go.dev/time#Duration.Seconds
   
   To avoid the additional plumbing change, you could even do that at this early stage, and have a 'RunForDuration' that accepts the time.Duration parameter, and this one, `Run` can avoid the parameter and pass the empty string downstream.
   
   This approach also eventually allows graceful support for the non-unix OSs which might have differently specified timeout mechanisms, that we could then take advantage of with alternative formats.

##########
File path: sdks/go/test/integration/expansions_test.go
##########
@@ -0,0 +1,169 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package integration
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/apache/beam/sdks/v2/go/test/integration/internal/jars"
+	"github.com/google/go-cmp/cmp"
+)
+
+type testProcess struct {
+	killed bool
+	jar    string
+}
+
+func (p *testProcess) Kill() error {
+	p.killed = true
+	return nil
+}
+
+func failRun(_, _ string, _ ...string) (jars.Process, error) {
+	return nil, fmt.Errorf("unexpectedly running a jar, failing")
+}
+
+func succeedRun(_, jar string, _ ...string) (jars.Process, error) {
+	return &testProcess{jar: jar}, nil
+}
+
+// TestExpansionServices_GetAddr_Addresses tests calling GetAddr on provided addresses.
+func TestExpansionServices_GetAddr_Addresses(t *testing.T) {
+	addrsMap := map[string]string{
+		"label1": "testAddr1",
+		"label2": "testAddr2",
+		"label3": "testAddr3",
+	}
+	jarsMap := map[string]string{
+		"label2": "jarFilepath2",
+	}
+	es := &ExpansionServices{
+		addrs: addrsMap,
+		jars:  jarsMap,
+		procs: make([]jars.Process, 0),
+		run:   failRun,
+	}
+
+	// Ensure we get the same map we put in, and that addresses take priority over jars if
+	// both are given for the same label.
+	for label, wantAddr := range addrsMap {
+		gotAddr, err := es.GetAddr(label)
+		if err != nil {
+			t.Errorf("unexpected error when getting address for \"%v\": %v", label, err)
+			continue
+		}
+		if gotAddr != wantAddr {
+			t.Errorf("incorrect address for \"%v\", want %v, got %v", label, wantAddr, gotAddr)
+		}
+	}
+	// Check that nonexistent labels fail.
+	if _, err := es.GetAddr("nonexistent_label"); err == nil {
+		t.Errorf("did not receive error when calling GetAddr with nonexistent label")
+	}
+}
+
+// TestExpansionServices_GetAddr_Jars tests calling GetAddr on provided jars.
+func TestExpansionServices_GetAddr_Jars(t *testing.T) {
+	addrsMap := map[string]string{}
+	jarsMap := map[string]string{
+		"label1": "jarFilepath1",
+		"label2": "jarFilepath2",
+		"label3": "jarFilepath3",
+	}
+	es := &ExpansionServices{
+		addrs: addrsMap,
+		jars:  jarsMap,
+		procs: make([]jars.Process, 0),
+		run:   succeedRun,
+	}
+
+	// Call GetAddr on each jar twice, checking that the addresses remain consistent.
+	gotMap := make(map[string]string)
+	for label := range jarsMap {
+		gotAddr, err := es.GetAddr(label)
+		if err != nil {
+			t.Errorf("unexpected error when getting address for \"%v\": %v", label, err)
+			continue
+		}
+		gotMap[label] = gotAddr
+	}
+	for label, gotAddr := range gotMap {
+		secondAddr, err := es.GetAddr(label)
+		if err != nil {
+			t.Errorf("unexpected error when getting address for \"%v\": %v", label, err)
+			continue
+		}
+		if secondAddr != gotAddr {
+			t.Errorf("getAddr returned different address when called twice for \"%v\", "+
+				"attempt 1: %v, attempt 2: %v", label, gotAddr, secondAddr)
+		}
+	}
+	// Check that all jars were run.
+	gotJars := make([]string, 0)
+	for _, proc := range es.procs {
+		testProc := proc.(*testProcess)
+		gotJars = append(gotJars, testProc.jar)
+	}
+	wantJars := make([]string, 0)
+	for _, jar := range jarsMap {
+		wantJars = append(wantJars, jar)
+	}
+	if diff := cmp.Diff(wantJars, gotJars); diff != "" {

Review comment:
       You'll need to add the unordered compare here, *or* sort the slices first. TBH I'd just sort the slices.

##########
File path: sdks/go/test/integration/expansions.go
##########
@@ -0,0 +1,116 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package integration
+
+import (
+	"fmt"
+	"strconv"
+	"time"
+
+	"github.com/apache/beam/sdks/v2/go/test/integration/internal/jars"
+	"github.com/apache/beam/sdks/v2/go/test/integration/internal/ports"
+)
+
+// ExpansionServices is a struct used for getting addresses and starting expansion services, based
+// on the --expansion_jar and --expansion_addr flags in this package. The main reason to use this
+// instead of accessing the flags directly is to let it handle jar startup and shutdown.
+//
+// Usage
+//
+// Create an ExpansionServices object in TestMain with NewExpansionServices. Then use GetAddr for
+// every expansion service needed for the test. Call Shutdown on it before finishing TestMain (or
+// simply defer a call to it).
+//
+// ExpansionServices is not concurrency safe, and so a single instance should not be used within
+// multiple individual tests, due to the possibility of those tests being run concurrently. It is
+// recommended to only use ExpansionServices in TestMain to avoid this.
+//
+// Example:
+//   var retCode int
+//   defer func() { os.Exit(retCode) }()  // Defer os.Exit so it happens after other defers.
+//   services := integration.NewExpansionServices()
+//   defer func() { services.Shutdown() }()
+//   addr, err := services.GetAddr("example")
+//   if err != nil {
+//     panic(err)
+//   }

Review comment:
       Note that panic does unwind the stack and executes defers, so you may want to explicitly set retCode = 1 before the panic to make sure it exits with an error state.




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] youngoli commented on a change in pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
youngoli commented on a change in pull request #16908:
URL: https://github.com/apache/beam/pull/16908#discussion_r819033619



##########
File path: sdks/go/test/integration/expansions_test.go
##########
@@ -0,0 +1,169 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package integration
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/apache/beam/sdks/v2/go/test/integration/internal/jars"
+	"github.com/google/go-cmp/cmp"
+)
+
+type testProcess struct {
+	killed bool
+	jar    string
+}
+
+func (p *testProcess) Kill() error {
+	p.killed = true
+	return nil
+}
+
+func failRun(_, _ string, _ ...string) (jars.Process, error) {
+	return nil, fmt.Errorf("unexpectedly running a jar, failing")
+}
+
+func succeedRun(_, jar string, _ ...string) (jars.Process, error) {
+	return &testProcess{jar: jar}, nil
+}
+
+// TestExpansionServices_GetAddr_Addresses tests calling GetAddr on provided addresses.
+func TestExpansionServices_GetAddr_Addresses(t *testing.T) {
+	addrsMap := map[string]string{
+		"label1": "testAddr1",
+		"label2": "testAddr2",
+		"label3": "testAddr3",
+	}
+	jarsMap := map[string]string{
+		"label2": "jarFilepath2",
+	}
+	es := &ExpansionServices{
+		addrs: addrsMap,
+		jars:  jarsMap,
+		procs: make([]jars.Process, 0),
+		run:   failRun,
+	}
+
+	// Ensure we get the same map we put in, and that addresses take priority over jars if
+	// both are given for the same label.
+	for label, wantAddr := range addrsMap {
+		gotAddr, err := es.GetAddr(label)
+		if err != nil {
+			t.Errorf("unexpected error when getting address for \"%v\": %v", label, err)
+			continue
+		}
+		if gotAddr != wantAddr {
+			t.Errorf("incorrect address for \"%v\", want %v, got %v", label, wantAddr, gotAddr)
+		}
+	}
+	// Check that nonexistent labels fail.
+	if _, err := es.GetAddr("nonexistent_label"); err == nil {
+		t.Errorf("did not receive error when calling GetAddr with nonexistent label")
+	}
+}
+
+// TestExpansionServices_GetAddr_Jars tests calling GetAddr on provided jars.
+func TestExpansionServices_GetAddr_Jars(t *testing.T) {
+	addrsMap := map[string]string{}
+	jarsMap := map[string]string{
+		"label1": "jarFilepath1",
+		"label2": "jarFilepath2",
+		"label3": "jarFilepath3",
+	}
+	es := &ExpansionServices{
+		addrs: addrsMap,
+		jars:  jarsMap,
+		procs: make([]jars.Process, 0),
+		run:   succeedRun,
+	}
+
+	// Call GetAddr on each jar twice, checking that the addresses remain consistent.
+	gotMap := make(map[string]string)
+	for label := range jarsMap {
+		gotAddr, err := es.GetAddr(label)
+		if err != nil {
+			t.Errorf("unexpected error when getting address for \"%v\": %v", label, err)
+			continue
+		}
+		gotMap[label] = gotAddr
+	}
+	for label, gotAddr := range gotMap {
+		secondAddr, err := es.GetAddr(label)
+		if err != nil {
+			t.Errorf("unexpected error when getting address for \"%v\": %v", label, err)
+			continue
+		}
+		if secondAddr != gotAddr {
+			t.Errorf("getAddr returned different address when called twice for \"%v\", "+
+				"attempt 1: %v, attempt 2: %v", label, gotAddr, secondAddr)
+		}
+	}
+	// Check that all jars were run.
+	gotJars := make([]string, 0)
+	for _, proc := range es.procs {
+		testProc := proc.(*testProcess)
+		gotJars = append(gotJars, testProc.jar)
+	}
+	wantJars := make([]string, 0)
+	for _, jar := range jarsMap {
+		wantJars = append(wantJars, jar)
+	}
+	if diff := cmp.Diff(wantJars, gotJars); diff != "" {

Review comment:
       Done.




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] riteshghorse commented on pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
riteshghorse commented on pull request #16908:
URL: https://github.com/apache/beam/pull/16908#issuecomment-1048901032


   Good change Daniel! Except @lostluck's suggestion rest looks good.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] youngoli merged pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
youngoli merged pull request #16908:
URL: https://github.com/apache/beam/pull/16908


   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] youngoli commented on a change in pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
youngoli commented on a change in pull request #16908:
URL: https://github.com/apache/beam/pull/16908#discussion_r819034838



##########
File path: sdks/go/test/integration/internal/jars/jars.go
##########
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package jars contains functionality for running jars for integration tests. The main entry point
+// for running a jar is the Run function. The Process interface is used to interact with the running
+// jars, and most importantly for shutting down the jars once finished with them.
+package jars
+
+import (
+	"fmt"
+	"os/exec"
+)
+
+type runCallback func(duration, jar string, args ...string) (Process, error)
+
+var runner runCallback // Saves which behavior to use when Run is called.
+
+func init() {
+	runner = getRunner()
+}
+
+// getRunner is used to determine the appropriate behavior for run during initialization time,
+// based on the OS and installed binaries of the system. This is returned as a runCallback which
+// can be called whenever Run is called. If an error prevents Run from being used at all (for
+// example, Java is not installed), then the runCallback will return that error.
+func getRunner() runCallback {
+	// First check if we can even run jars.
+	_, err := exec.LookPath("java")
+	if err != nil {
+		err := fmt.Errorf("cannot run jar: 'java' command not installed: %w", err)
+		return func(_, _ string, _ ...string) (Process, error) {
+			return nil, err
+		}
+	}
+
+	// Defer to OS-specific logic for checking for presence of timeout command.
+	return getTimeoutRunner()
+}
+
+// Run runs a jar given an optional duration, a path to the jar, and any desired arguments to the
+// jar. It returns a Process object which can be used to shut down the jar once finished.
+//
+// The duration parameter is a duration for the timeout command which can be used to automatically
+// kill the jar after a set duration, in order to avoid resource leakage. It is described here:
+// https://man7.org/linux/man-pages/man1/timeout.1.html. If a duration is provided but the system
+// is unable to use the timeout command, this function will return an error. To indicate that a
+// duration isn't needed, pass in an empty string.
+func Run(duration, jar string, args ...string) (Process, error) {

Review comment:
       Done. Although I left the plumbing change in. It's easy enough now, and would make graceful support for non-unix OS easier in the future by having the parsing of the duration present in OS-specific code.




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] jrmccluskey commented on pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
jrmccluskey commented on pull request #16908:
URL: https://github.com/apache/beam/pull/16908#issuecomment-1050053555


   Portable PreCommit isn't thrilled about this either, but this time it's a flag issue:
   
   ```
   > Task :sdks:go:test:ulrValidatesRunner
   Feb 19, 2022 1:38:42 AM org.apache.beam.sdk.expansion.service.ExpansionService loadRegisteredTransforms
   INFO: Registering external transforms: [beam:transforms:xlang:test:cgbk, beam:transforms:xlang:test:flatten, beam:transforms:xlang:test:prefix, beam:transforms:xlang:test:multi, beam:transforms:xlang:test:gbk, beam:transforms:xlang:test:comgl, beam:transforms:xlang:test:compk, beam:transforms:xlang:count, beam:transforms:xlang:filter_less_than_eq, beam:transforms:xlang:test:partition, beam:transforms:xlang:test:parquet_write, beam:transforms:xlang:parquet_read, beam:transforms:xlang:textio_read, beam:external:java:generate_sequence:v1]
   INFO:apache_beam.runners.portability.local_job_service:Grpc server started at localhost on port 56391
   INFO:__main__:Listening for beam jobs on port 56391.
   go1.16.12: already downloaded in /home/jenkins/sdk/go1.16.12
   System Go installation: /snap/bin/go is go version go1.16.13 linux/amd64; Preparing to use /home/jenkins/go/bin/go1.16.12
   go1.16.12: already downloaded in /home/jenkins/sdk/go1.16.12
   /home/jenkins/go/bin/go1.16.12 test -v ./test/integration/... ./test/regression -p 3 -timeout 2h --runner=portable --project=apache-beam-testing --region=us-central1 --environment_type=DOCKER --environment_config=apache/beam_go_sdk:dev --staging_location=gs://temp-storage-for-end-to-end-tests/staging-validatesrunner-test --temp_location=gs://temp-storage-for-end-to-end-tests/temp-validatesrunner-test --dataflow_worker_jar= --endpoint=localhost:56391 --test_expansion_addr=localhost:33671
   flag provided but not defined: -project
   ```


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] lostluck commented on pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
lostluck commented on pull request #16908:
URL: https://github.com/apache/beam/pull/16908#issuecomment-1048052221


   New test is failing. It looks like sorting before comparing is the right move probably...
   ```
   17:36:51 --- FAIL: TestExpansionServices_GetAddr_Jars (9.00s)
   17:36:51     expansions_test.go:126: processes in ExpansionServices does not match jars that should be running: diff(-want,+got):
   17:36:51           []string{
   17:36:51         - 	"jarFilepath2",
   17:36:51           	"jarFilepath3",
   17:36:51           	"jarFilepath1",
   17:36:51         + 	"jarFilepath2",
   17:36:51           }
   17:36:51 FAIL
   ```


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] youngoli commented on pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
youngoli commented on pull request #16908:
URL: https://github.com/apache/beam/pull/16908#issuecomment-1045514115


   R: @lostluck @riteshghorse @jrmccluskey 
   
   This seems like it would be good to be reviewed by anyone who's likely to implement an integration test sometime soon.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [beam] youngoli commented on a change in pull request #16908: [BEAM-13857] Add K:V flags for expansion service jars and addresses to Go ITs.

Posted by GitBox <gi...@apache.org>.
youngoli commented on a change in pull request #16908:
URL: https://github.com/apache/beam/pull/16908#discussion_r819033562



##########
File path: sdks/go/test/integration/expansions.go
##########
@@ -0,0 +1,116 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package integration
+
+import (
+	"fmt"
+	"strconv"
+	"time"
+
+	"github.com/apache/beam/sdks/v2/go/test/integration/internal/jars"
+	"github.com/apache/beam/sdks/v2/go/test/integration/internal/ports"
+)
+
+// ExpansionServices is a struct used for getting addresses and starting expansion services, based
+// on the --expansion_jar and --expansion_addr flags in this package. The main reason to use this
+// instead of accessing the flags directly is to let it handle jar startup and shutdown.
+//
+// Usage
+//
+// Create an ExpansionServices object in TestMain with NewExpansionServices. Then use GetAddr for
+// every expansion service needed for the test. Call Shutdown on it before finishing TestMain (or
+// simply defer a call to it).
+//
+// ExpansionServices is not concurrency safe, and so a single instance should not be used within
+// multiple individual tests, due to the possibility of those tests being run concurrently. It is
+// recommended to only use ExpansionServices in TestMain to avoid this.
+//
+// Example:
+//   var retCode int
+//   defer func() { os.Exit(retCode) }()  // Defer os.Exit so it happens after other defers.
+//   services := integration.NewExpansionServices()
+//   defer func() { services.Shutdown() }()
+//   addr, err := services.GetAddr("example")
+//   if err != nil {
+//     panic(err)
+//   }

Review comment:
       Done.




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org