lostluck commented on a change in pull request #15482:
URL: https://github.com/apache/beam/pull/15482#discussion_r717872892



##########
File path: sdks/go/test/integration/wordcount/wordcount_test.go
##########
@@ -30,16 +31,26 @@ import (
 
 func TestWordCount(t *testing.T) {
        tests := []struct {
-               lines []string
-               words int
-               hash  string
+               lines                                                           
  []string
+               words                                                           
  int
+               hash                                                            
  string
+               smallWords                                                      
  string
+               lineLen                                                         
  string

Review comment:
       Remove the constants here and use them down in the test. We don't need 
per-test case repetitions of the same thing. The goal is for things to be as 
configurable as necessary, but not further, so we can *reduce* repetition.

##########
File path: sdks/go/test/integration/wordcount/wordcount.go
##########
@@ -30,9 +30,10 @@ import (
 )
 
 var (
-       wordRE  = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
-       empty   = beam.NewCounter("extract", "emptyLines")
-       lineLen = beam.NewDistribution("extract", "lineLenDistro")
+       wordRE      = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
+       empty       = beam.NewCounter("extract", "emptyLines")
+       lineLen     = beam.NewDistribution("extract", "lineLenDistro")
+       small_words = beam.NewCounter("extract", "smallWords")

Review comment:
       ```suggestion
        smallWords = beam.NewCounter("extract", "smallWords")
   ```
   
   And the use beow.

##########
File path: sdks/go/test/integration/wordcount/wordcount_test.go
##########
@@ -30,16 +31,26 @@ import (
 
 func TestWordCount(t *testing.T) {
        tests := []struct {
-               lines []string
-               words int
-               hash  string
+               lines                                                           
  []string
+               words                                                           
  int
+               hash                                                            
  string
+               smallWords                                                      
  string
+               lineLen                                                         
  string
+               smallWordsCount, lineLenCount, lineLenSum, lineLenMin, 
lineLenMax int64

Review comment:
       I was mistaken earlier. We can do something simpler for the Distribution 
metric, by using a metrics.DistributionValue.
   
   So `lineLen metricsDistributionValue`
   
   then we can configure things with `metrics.DistributionValue{1,1,3,3},`  etc
   
   And just do a straight equality check on the value
   
   `distributonValue != test.lineLen`




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