[
https://issues.apache.org/jira/browse/BEAM-13695?focusedWorklogId=755995&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-755995
]
ASF GitHub Bot logged work on BEAM-13695:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Apr/22 19:54
Start Date: 12/Apr/22 19:54
Worklog Time Spent: 10m
Work Description: damccorm commented on code in PR #17178:
URL: https://github.com/apache/beam/pull/17178#discussion_r848810226
##########
sdks/java/container/boot_test.go:
##########
@@ -0,0 +1,73 @@
+// 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.
+
+// boot is the boot code for the Java SDK harness container. It is responsible
+// for retrieving staged files and invoking the JVM correctly.
+package main
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestBuildOptionsEmpty(t *testing.T) {
+ metaOptions, err := LoadMetaOptions("test/empty")
+ if metaOptions != nil {
+ t.Errorf("Got %v for meta options, but expected nil", metaOptions)
+ }
+ if err != nil {
+ t.Errorf("Got error %v running LoadMetaOptions", err)
+ }
Review Comment:
2 (related) things here:
1) Use `t.Fatalf` for errors that should stop test execution. In this case,
both the err check and metaOptions check keep the rest of the test from being
useful so they should be fatal.
2) Prefer ordering the err check above the metaOptions check since the
metaOptions check isn't informative if we return an error.
The Fatalf comment applies to the rest of the tests as well.
##########
sdks/java/container/boot_test.go:
##########
@@ -0,0 +1,73 @@
+// 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.
+
+// boot is the boot code for the Java SDK harness container. It is responsible
+// for retrieving staged files and invoking the JVM correctly.
+package main
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestBuildOptionsEmpty(t *testing.T) {
+ metaOptions, err := LoadMetaOptions("test/empty")
+ if metaOptions != nil {
+ t.Errorf("Got %v for meta options, but expected nil", metaOptions)
Review Comment:
Nit: Prefer got/want syntax with function identification -
https://github.com/golang/go/wiki/TestComments#identify-the-function
So for this one:
```
dir := "test/empty"
metaOptions, err := LoadMetaOptions(dir)
if metaOptions != nil {
t.Fatalf("LoadMetaOptions(%v) = %v, want nil", dir, metaOptions)
}
```
or a more complete example below:
`t.Errorf("BuildOptions(%v).JavaProperties = %v, want %v", metaOptions,
javaOptions.Properties, wantProperties)`
Issue Time Tracking
-------------------
Worklog Id: (was: 755995)
Time Spent: 4h 10m (was: 4h)
> Provide more accurate size estimates for cache objects in Java 17
> -----------------------------------------------------------------
>
> Key: BEAM-13695
> URL: https://issues.apache.org/jira/browse/BEAM-13695
> Project: Beam
> Issue Type: Improvement
> Components: sdk-java-harness
> Reporter: Kiley Sok
> Assignee: Kiley Sok
> Priority: P2
> Time Spent: 4h 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)