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/03/18 17:15:44 UTC
[GitHub] [beam] jrmccluskey opened a new pull request #17124: [BEAM-13889] Add test cases to jsonx package
jrmccluskey opened a new pull request #17124:
URL: https://github.com/apache/beam/pull/17124
Adds some brief unit test cases to the jsonx package. Largely just ensures that inputs and outputs are equal and follow expected behavior.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
- [ ] 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.
- [ ] 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/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](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] github-actions[bot] commented on pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1072627735
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control
--
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 #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #17124:
URL: https://github.com/apache/beam/pull/17124#discussion_r831333707
##########
File path: sdks/go/pkg/beam/core/util/jsonx/jsonx_test.go
##########
@@ -0,0 +1,82 @@
+// 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 jsonx
+
+import (
+ "math"
+ "testing"
+)
+
+type someStruct struct {
+ SomeNumber int64
+ SomeString string
+ SomeBoolean bool
+}
+
+func (s *someStruct) equals(other *someStruct) bool {
+ return (s.SomeNumber == other.SomeNumber) && (s.SomeString == other.SomeString) && (s.SomeBoolean == other.SomeBoolean)
+}
+
+func TestEncodeDecode(t *testing.T) {
+ var tests = []struct {
+ name string
+ inputNum int64
+ inputString string
+ inputBool bool
+ }{
+ {
+ "simple inputs",
+ 10,
+ "information",
+ true,
+ },
+ {
+ "default inputs",
+ 0,
+ "",
+ false,
+ },
+ {
+ "maximum int",
+ math.MaxInt64,
+ "big int",
+ true,
+ },
+ {
+ "minimum int",
+ math.MinInt64,
+ "little int",
+ false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ inputStruct := &someStruct{SomeNumber: test.inputNum, SomeString: test.inputString, SomeBoolean: test.inputBool}
+ enc, err := Marshal(inputStruct)
+ if err != nil {
+ t.Fatalf("Marshal(%v) failed, got %v", inputStruct, err)
+ }
Review comment:
(We'd also need to make sure it works for the variety of DoFns in use internally to Google as well, so it's not necessarily simple work.)
--
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 a change in pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
jrmccluskey commented on a change in pull request #17124:
URL: https://github.com/apache/beam/pull/17124#discussion_r831109331
##########
File path: sdks/go/pkg/beam/core/util/jsonx/jsonx_test.go
##########
@@ -0,0 +1,82 @@
+// 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 jsonx
+
+import (
+ "math"
+ "testing"
+)
+
+type someStruct struct {
+ SomeNumber int64
+ SomeString string
+ SomeBoolean bool
+}
+
+func (s *someStruct) equals(other *someStruct) bool {
+ return (s.SomeNumber == other.SomeNumber) && (s.SomeString == other.SomeString) && (s.SomeBoolean == other.SomeBoolean)
+}
+
+func TestEncodeDecode(t *testing.T) {
+ var tests = []struct {
+ name string
+ inputNum int64
+ inputString string
+ inputBool bool
+ }{
+ {
+ "simple inputs",
+ 10,
+ "information",
+ true,
+ },
+ {
+ "default inputs",
+ 0,
+ "",
+ false,
+ },
+ {
+ "maximum int",
+ math.MaxInt64,
+ "big int",
+ true,
+ },
+ {
+ "minimum int",
+ math.MinInt64,
+ "little int",
+ false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ inputStruct := &someStruct{SomeNumber: test.inputNum, SomeString: test.inputString, SomeBoolean: test.inputBool}
+ enc, err := Marshal(inputStruct)
+ if err != nil {
+ t.Fatalf("Marshal(%v) failed, got %v", inputStruct, err)
+ }
Review comment:
This package is in a bit of a weird position in that it has already been earmarked for eventual deprecation once the SDK defaults to schemas. I couldn't tell you how far along we are to consider that complete, but it may be worth looking into. In the meantime, the json package has a `Valid()` function that checks if a byte slice is a valid JSON encoding. That should be straightforward, albeit somewhat unsatisfying given that we're really just making sure our dips into the json package's functions are working as intended.
Glad you caught the branch name, this has increasingly become my convention if there's a good name
--
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 #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
jrmccluskey commented on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1072625568
R: @damccorm @riteshghorse
--
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] codecov[bot] edited a comment on pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1072624743
# [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#17124](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (424ba7e) into [master](https://codecov.io/gh/apache/beam/commit/d7f7f8e587a56fbc7fbfbdd8b010a8f6991234ee?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d7f7f8e) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #17124 +/- ##
=======================================
Coverage 73.96% 73.96%
=======================================
Files 671 672 +1
Lines 88221 88235 +14
=======================================
+ Hits 65250 65261 +11
- Misses 21859 21861 +2
- Partials 1112 1113 +1
```
| Flag | Coverage Δ | |
|---|---|---|
| go | `49.46% <ø> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [sdks/go/pkg/beam/core/util/jsonx/jsonx.go](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9nby9wa2cvYmVhbS9jb3JlL3V0aWwvanNvbngvanNvbnguZ28=) | `78.57% <0.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d7f7f8e...424ba7e](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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] damccorm commented on a change in pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
damccorm commented on a change in pull request #17124:
URL: https://github.com/apache/beam/pull/17124#discussion_r831091254
##########
File path: sdks/go/pkg/beam/core/util/jsonx/jsonx_test.go
##########
@@ -0,0 +1,82 @@
+// 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 jsonx
+
+import (
+ "math"
+ "testing"
+)
+
+type someStruct struct {
+ SomeNumber int64
+ SomeString string
+ SomeBoolean bool
+}
+
+func (s *someStruct) equals(other *someStruct) bool {
+ return (s.SomeNumber == other.SomeNumber) && (s.SomeString == other.SomeString) && (s.SomeBoolean == other.SomeBoolean)
+}
+
+func TestEncodeDecode(t *testing.T) {
+ var tests = []struct {
+ name string
+ inputNum int64
+ inputString string
+ inputBool bool
+ }{
+ {
+ "simple inputs",
+ 10,
+ "information",
+ true,
+ },
+ {
+ "default inputs",
+ 0,
+ "",
+ false,
+ },
+ {
+ "maximum int",
+ math.MaxInt64,
+ "big int",
+ true,
+ },
+ {
+ "minimum int",
+ math.MinInt64,
+ "little int",
+ false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ inputStruct := &someStruct{SomeNumber: test.inputNum, SomeString: test.inputString, SomeBoolean: test.inputBool}
+ enc, err := Marshal(inputStruct)
+ if err != nil {
+ t.Fatalf("Marshal(%v) failed, got %v", inputStruct, err)
+ }
Review comment:
This is a bit nitpicky, but a more robust test would check that this is actually getting encoded to json - right now, all we've tested is that we're able to serialize/deserialize into some protocol, not that its actually valid json. One way to do this would be to compare the byte contents, an easier way is probably to just use the json package.
That actually brings me to a larger question - do we actually need this package? Or would we be better off removing references to it (switching to the json package) and deprecating this one. By my count we only have 3 files that use any of this functionality, and all of them could very easily be replaced by calls to the json package.
I'm ok taking this pr and not deprecating this, but I think its at least worth considering.
##########
File path: sdks/go/pkg/beam/core/util/jsonx/jsonx_test.go
##########
@@ -0,0 +1,82 @@
+// 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 jsonx
+
+import (
+ "math"
+ "testing"
+)
+
+type someStruct struct {
+ SomeNumber int64
+ SomeString string
+ SomeBoolean bool
+}
+
+func (s *someStruct) equals(other *someStruct) bool {
+ return (s.SomeNumber == other.SomeNumber) && (s.SomeString == other.SomeString) && (s.SomeBoolean == other.SomeBoolean)
+}
+
+func TestEncodeDecode(t *testing.T) {
+ var tests = []struct {
+ name string
+ inputNum int64
+ inputString string
+ inputBool bool
+ }{
+ {
+ "simple inputs",
+ 10,
+ "information",
+ true,
+ },
+ {
+ "default inputs",
+ 0,
+ "",
+ false,
+ },
+ {
+ "maximum int",
+ math.MaxInt64,
+ "big int",
+ true,
+ },
+ {
+ "minimum int",
+ math.MinInt64,
+ "little int",
+ false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ inputStruct := &someStruct{SomeNumber: test.inputNum, SomeString: test.inputString, SomeBoolean: test.inputBool}
+ enc, err := Marshal(inputStruct)
+ if err != nil {
+ t.Fatalf("Marshal(%v) failed, got %v", inputStruct, err)
+ }
Review comment:
Also, unrelated to the review - I appreciate the branch name
--
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 #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
jrmccluskey commented on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1074096954
R: @lostluck @youngoli
--
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] codecov[bot] edited a comment on pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1072624743
# [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#17124](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (55b0971) into [master](https://codecov.io/gh/apache/beam/commit/d7f7f8e587a56fbc7fbfbdd8b010a8f6991234ee?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d7f7f8e) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #17124 +/- ##
=======================================
Coverage 73.95% 73.96%
=======================================
Files 671 672 +1
Lines 88221 88241 +20
=======================================
+ Hits 65247 65267 +20
+ Misses 21862 21861 -1
- Partials 1112 1113 +1
```
| Flag | Coverage Δ | |
|---|---|---|
| go | `49.47% <ø> (+0.02%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...che\_beam/runners/interactive/interactive\_runner.py](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9pbnRlcmFjdGl2ZS9pbnRlcmFjdGl2ZV9ydW5uZXIucHk=) | `92.02% <0.00%> (-0.73%)` | :arrow_down: |
| [sdks/go/pkg/beam/core/util/reflectx/tags.go](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9nby9wa2cvYmVhbS9jb3JlL3V0aWwvcmVmbGVjdHgvdGFncy5nbw==) | `0.00% <0.00%> (ø)` | |
| [sdks/go/pkg/beam/core/util/jsonx/jsonx.go](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9nby9wa2cvYmVhbS9jb3JlL3V0aWwvanNvbngvanNvbnguZ28=) | `78.57% <0.00%> (ø)` | |
| [...ks/python/apache\_beam/runners/worker/sdk\_worker.py](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvc2RrX3dvcmtlci5weQ==) | `89.06% <0.00%> (+0.15%)` | :arrow_up: |
| [sdks/go/pkg/beam/core/runtime/pipelinex/replace.go](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9nby9wa2cvYmVhbS9jb3JlL3J1bnRpbWUvcGlwZWxpbmV4L3JlcGxhY2UuZ28=) | `66.66% <0.00%> (+0.71%)` | :arrow_up: |
| [sdks/python/apache\_beam/io/source\_test\_utils.py](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vaW8vc291cmNlX3Rlc3RfdXRpbHMucHk=) | `89.40% <0.00%> (+1.38%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d7f7f8e...55b0971](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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] codecov[bot] edited a comment on pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1072624743
# [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#17124](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (424ba7e) into [master](https://codecov.io/gh/apache/beam/commit/d7f7f8e587a56fbc7fbfbdd8b010a8f6991234ee?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d7f7f8e) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.
> :exclamation: Current head 424ba7e differs from pull request most recent head 55b0971. Consider uploading reports for the commit 55b0971 to get more accurate results
```diff
@@ Coverage Diff @@
## master #17124 +/- ##
=======================================
Coverage 73.95% 73.96%
=======================================
Files 671 672 +1
Lines 88221 88235 +14
=======================================
+ Hits 65247 65261 +14
+ Misses 21862 21861 -1
- Partials 1112 1113 +1
```
| Flag | Coverage Δ | |
|---|---|---|
| go | `49.46% <ø> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...che\_beam/runners/interactive/interactive\_runner.py](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9pbnRlcmFjdGl2ZS9pbnRlcmFjdGl2ZV9ydW5uZXIucHk=) | `92.02% <0.00%> (-0.73%)` | :arrow_down: |
| [sdks/go/pkg/beam/core/util/jsonx/jsonx.go](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9nby9wa2cvYmVhbS9jb3JlL3V0aWwvanNvbngvanNvbnguZ28=) | `78.57% <0.00%> (ø)` | |
| [...ks/python/apache\_beam/runners/worker/sdk\_worker.py](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvc2RrX3dvcmtlci5weQ==) | `89.06% <0.00%> (+0.15%)` | :arrow_up: |
| [sdks/python/apache\_beam/io/source\_test\_utils.py](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vaW8vc291cmNlX3Rlc3RfdXRpbHMucHk=) | `89.40% <0.00%> (+1.38%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d7f7f8e...55b0971](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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 #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #17124:
URL: https://github.com/apache/beam/pull/17124#discussion_r831332840
##########
File path: sdks/go/pkg/beam/core/util/jsonx/jsonx_test.go
##########
@@ -0,0 +1,82 @@
+// 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 jsonx
+
+import (
+ "math"
+ "testing"
+)
+
+type someStruct struct {
+ SomeNumber int64
+ SomeString string
+ SomeBoolean bool
+}
+
+func (s *someStruct) equals(other *someStruct) bool {
+ return (s.SomeNumber == other.SomeNumber) && (s.SomeString == other.SomeString) && (s.SomeBoolean == other.SomeBoolean)
+}
+
+func TestEncodeDecode(t *testing.T) {
+ var tests = []struct {
+ name string
+ inputNum int64
+ inputString string
+ inputBool bool
+ }{
+ {
+ "simple inputs",
+ 10,
+ "information",
+ true,
+ },
+ {
+ "default inputs",
+ 0,
+ "",
+ false,
+ },
+ {
+ "maximum int",
+ math.MaxInt64,
+ "big int",
+ true,
+ },
+ {
+ "minimum int",
+ math.MinInt64,
+ "little int",
+ false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ inputStruct := &someStruct{SomeNumber: test.inputNum, SomeString: test.inputString, SomeBoolean: test.inputBool}
+ enc, err := Marshal(inputStruct)
+ if err != nil {
+ t.Fatalf("Marshal(%v) failed, got %v", inputStruct, err)
+ }
Review comment:
This package existed because internally to Google, we needed to migrate to the Go 1.16+ version of the JSON package prior to it becoming available, and abstracting it to a single package allowed all common uses to migrate in one place, rather than in the few places. It also allowed registering of the protojson package with the standard JSON encoder, so that protocol buffers actually get JSON encoded.
There's one place we do need to migrate to schemas before we get rid of the package though and that is DoFn serialization. It was never a quick enough change that I could prioritize it.
--
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 merged pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
lostluck merged pull request #17124:
URL: https://github.com/apache/beam/pull/17124
--
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] codecov[bot] commented on pull request #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #17124:
URL: https://github.com/apache/beam/pull/17124#issuecomment-1072624743
# [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#17124](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (424ba7e) into [master](https://codecov.io/gh/apache/beam/commit/d7f7f8e587a56fbc7fbfbdd8b010a8f6991234ee?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d7f7f8e) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #17124 +/- ##
=======================================
Coverage 73.96% 73.96%
=======================================
Files 671 672 +1
Lines 88221 88235 +14
=======================================
+ Hits 65250 65261 +11
- Misses 21859 21861 +2
- Partials 1112 1113 +1
```
| Flag | Coverage Δ | |
|---|---|---|
| go | `49.46% <ø> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [sdks/go/pkg/beam/core/util/jsonx/jsonx.go](https://codecov.io/gh/apache/beam/pull/17124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9nby9wa2cvYmVhbS9jb3JlL3V0aWwvanNvbngvanNvbnguZ28=) | `78.57% <0.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d7f7f8e...424ba7e](https://codecov.io/gh/apache/beam/pull/17124?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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 #17124: [BEAM-13889] Add test cases to jsonx package
Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #17124:
URL: https://github.com/apache/beam/pull/17124#discussion_r831332840
##########
File path: sdks/go/pkg/beam/core/util/jsonx/jsonx_test.go
##########
@@ -0,0 +1,82 @@
+// 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 jsonx
+
+import (
+ "math"
+ "testing"
+)
+
+type someStruct struct {
+ SomeNumber int64
+ SomeString string
+ SomeBoolean bool
+}
+
+func (s *someStruct) equals(other *someStruct) bool {
+ return (s.SomeNumber == other.SomeNumber) && (s.SomeString == other.SomeString) && (s.SomeBoolean == other.SomeBoolean)
+}
+
+func TestEncodeDecode(t *testing.T) {
+ var tests = []struct {
+ name string
+ inputNum int64
+ inputString string
+ inputBool bool
+ }{
+ {
+ "simple inputs",
+ 10,
+ "information",
+ true,
+ },
+ {
+ "default inputs",
+ 0,
+ "",
+ false,
+ },
+ {
+ "maximum int",
+ math.MaxInt64,
+ "big int",
+ true,
+ },
+ {
+ "minimum int",
+ math.MinInt64,
+ "little int",
+ false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ inputStruct := &someStruct{SomeNumber: test.inputNum, SomeString: test.inputString, SomeBoolean: test.inputBool}
+ enc, err := Marshal(inputStruct)
+ if err != nil {
+ t.Fatalf("Marshal(%v) failed, got %v", inputStruct, err)
+ }
Review comment:
This package existed because internally to Google, we needed to migrate to the Go 1.16+ version of the JSON package prior to it becoming externally available so we could register of the protojson package with the standard JSON encoder, so that protocol buffers actually get JSON encoded.
There's one place we do need to migrate to schemas before we get rid of the package though and that is DoFn serialization. It was never a quick enough change that I could prioritize it.
--
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