tszerszen commented on a change in pull request #13245:
URL: https://github.com/apache/beam/pull/13245#discussion_r517268738
##########
File path: sdks/go/pkg/beam/io/synthetic/source_test.go
##########
@@ -168,62 +169,48 @@ func TestSourceConfig_BuildFromJSON(t *testing.T) {
// for a synthetic source works correctly.
func TestSourceConfigBuilder_NumHotKeys(t *testing.T) {
tests := []struct {
- elms int
- hotKeys int
+ elms int
+ hotKeys int
+ hotKeyFraction float64
}{
- {elms: 15, hotKeys: 2},
- {elms: 30, hotKeys: 10},
- {elms: 50, hotKeys: 25},
+ {elms: 15, hotKeys: 2, hotKeyFraction: 1.0},
+ {elms: 30, hotKeys: 10, hotKeyFraction: 1.0},
+ {elms: 50, hotKeys: 25, hotKeyFraction: 1.0},
+ {elms: 30, hotKeys: 10, hotKeyFraction: 0.5},
+ {elms: 50, hotKeys: 25, hotKeyFraction: 0.75},
}
for _, test := range tests {
test := test
t.Run(fmt.Sprintf("(elm = %v)", test.hotKeys), func(t
*testing.T) {
dfn := sourceFn{}
cfg := DefaultSourceConfig()
cfg.NumElements(test.elms)
- cfg.HotKeyFraction(1.0)
+ cfg.HotKeyFraction(test.hotKeyFraction)
cfg.NumHotKeys(test.hotKeys)
keys, _, err := simulateSourceFn(t, &dfn, cfg.Build())
if err != nil {
t.Errorf("Failure processing sourceFn: %v", err)
}
- type val struct {
- num int
- isHotKey bool
- }
-
- m := make(map[string]val)
+ m := make(map[string]int)
for i := 0; i < len(keys); i++ {
Review comment:
You're right, thank you I pushed the fix.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]