riteshghorse commented on a change in pull request #17003:
URL: https://github.com/apache/beam/pull/17003#discussion_r823854482



##########
File path: sdks/go/pkg/beam/options/jobopts/options_test.go
##########
@@ -0,0 +1,122 @@
+// 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 jobopts
+
+import (
+       "context"
+       "reflect"
+       "strings"
+       "testing"
+
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/core"
+)
+
+func TestGetEndpoint(t *testing.T) {
+       address := "localhost:8099"
+       Endpoint = &address
+       v, err := GetEndpoint()
+       if err != nil {
+               t.Fatalf("unexpected error GetEndpoint(): %v", err)
+       }
+       if v != address {
+               t.Errorf("GetEndpoint() = %v, want %v", v, address)
+       }
+}
+
+func TestGetEndpoint_Bad(t *testing.T) {
+       address := ""
+       Endpoint = &address
+       expectedErr := "no job service endpoint specified. Use 
--endpoint=<endpoint>"

Review comment:
       Done

##########
File path: sdks/go/pkg/beam/options/jobopts/options_test.go
##########
@@ -0,0 +1,122 @@
+// 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 jobopts
+
+import (
+       "context"
+       "reflect"
+       "strings"
+       "testing"
+
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/core"
+)
+
+func TestGetEndpoint(t *testing.T) {
+       address := "localhost:8099"
+       Endpoint = &address
+       v, err := GetEndpoint()
+       if err != nil {
+               t.Fatalf("unexpected error GetEndpoint(): %v", err)
+       }
+       if v != address {
+               t.Errorf("GetEndpoint() = %v, want %v", v, address)
+       }
+}
+
+func TestGetEndpoint_Bad(t *testing.T) {
+       address := ""
+       Endpoint = &address
+       expectedErr := "no job service endpoint specified. Use 
--endpoint=<endpoint>"
+       if _, err := GetEndpoint(); err == nil {
+               t.Errorf("GetEndpoint() executed incorrectly, expected error: 
%v", expectedErr)
+       }
+}
+
+func TestGetJobName(t *testing.T) {
+       tests := []struct {
+               jobname  string
+               wantName string
+       }{
+               {
+                       "",
+                       "go-job-",
+               },
+               {
+                       "go-job-example",
+                       "go-job-example",
+               },
+       }
+       for _, test := range tests {
+               JobName = &test.jobname
+               if got := GetJobName(); !strings.Contains(got, test.wantName) {
+                       t.Errorf("GetJobName() = %v, want %v", got, 
test.wantName)
+               }
+       }
+}
+
+func TestGetEnvironamentUrn(t *testing.T) {
+       tests := []struct {
+               env string
+               urn string
+       }{

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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to