[ 
https://issues.apache.org/jira/browse/BEAM-13906?focusedWorklogId=732693&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-732693
 ]

ASF GitHub Bot logged work on BEAM-13906:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Feb/22 21:19
            Start Date: 24/Feb/22 21:19
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #16934:
URL: https://github.com/apache/beam/pull/16934#discussion_r814276563



##########
File path: sdks/go/pkg/beam/internal/errors/errors_test.go
##########
@@ -147,10 +170,51 @@ func TestSetTopLevelMsgf(t *testing.T) {
        }
 }
 
+func TestSetTopLevelMsgf_NilErr(t *testing.T) {
+       want := ""
+       err := SetTopLevelMsgf(nil, "%s %d", "ten", 10)
+       if getTop(err) != want {
+               t.Errorf("Incorrect formatting. Want: %q, Got: %q", want, 
getTop(err))
+       }
+}
+
+func TestError(t *testing.T) {
+       tests := []struct {
+               err  error
+               want string
+       }{
+               {
+                       err:  Wrap(New(base), msg1),
+                       want: "message 1\n\tcaused by:\nbase",
+               },
+               {
+                       err:  SetTopLevelMsg(New(base), top1),
+                       want: "top level message 1\nFull error:\nbase",
+               },
+               {
+                       err:  SetTopLevelMsg(Wrap(Wrap(New(base), msg1), msg2), 
top1),
+                       want: "top level message 1\nFull error:\nmessage 
2\n\tcaused by:\nmessage 1\n\tcaused by:\nbase",
+               },
+       }
+
+       for _, test := range tests {
+               if be, ok := test.err.(*beamError); ok {
+                       if got, want := be.Error(), test.want; got != want {
+                               t.Errorf("Incorrect formatting. Want: %q, Got: 
%q", want, got)
+                       }
+               } else {
+                       t.Errorf("Error should be type beamError, got: %q", 
test.err)

Review comment:
       Types and their pointers are distinct types, even though the pointer 
variant is derived. I'm going to commit the suggested edit but wanted to 
clarify what it was I was doing.
   
   ```suggestion
                        t.Errorf("Error should be type *beamError, got: %q", 
test.err)
   ```




-- 
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 732693)
    Time Spent: 1h 20m  (was: 1h 10m)

> Add unit testing to the errors package
> --------------------------------------
>
>                 Key: BEAM-13906
>                 URL: https://issues.apache.org/jira/browse/BEAM-13906
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-go
>            Reporter: Jack McCluskey
>            Assignee: Danny McCormick
>            Priority: P2
>              Labels: starter
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Increase unit testing coverage in the [internal errors 
> package|https://github.com/apache/beam/tree/release-2.36.0/sdks/go/pkg/beam/internal/errors]
> We want code coverage at or above 50%, it is currently at 39.5%.
> There are a number of tests already present for this package, most of this 
> task is finding the gaps in code coverage and writing test cases for them.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to