[telemetry] godev/cmd/worker: add unit test for normalizeCounterName

0 views
Skip to first unread message

Hongxiang Jiang (Gerrit)

unread,
11:23 AM (10 hours ago) 11:23 AM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Hongxiang Jiang has uploaded the change for review

Commit message

godev/cmd/worker: add unit test for normalizeCounterName
Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672

Change diff

diff --git a/godev/cmd/worker/main_test.go b/godev/cmd/worker/main_test.go
index 352b7f2..b5af0da 100644
--- a/godev/cmd/worker/main_test.go
+++ b/godev/cmd/worker/main_test.go
@@ -504,3 +504,58 @@
t.Errorf("charts = %+v\n, (-want +got): %v", got, diff)
}
}
+
+func TestNormalizeCounterName(t *testing.T) {
+ testcases := []struct {
+ name string
+ prefix string
+ counter string
+ want string
+ }{
+ {
+ name: "strip patch version for Version",
+ prefix: "Version",
+ counter: "v0.15.3",
+ want: "Version:v0.15",
+ },
+ {
+ name: "strip patch go version for Version",
+ prefix: "Version",
+ counter: "go1.12.3",
+ want: "Version:go1.12",
+ },
+ {
+ name: "concatenate devel for Version",
+ prefix: "Version",
+ counter: "devel",
+ want: "Version:devel",
+ },
+ {
+ name: "concatenate for GOOS",
+ prefix: "GOOS",
+ counter: "darwin",
+ want: "GOOS:darwin",
+ },
+ {
+ name: "concatenate for GOARCH",
+ prefix: "GOARCH",
+ counter: "amd64",
+ want: "GOARCH:amd64",
+ },
+ {
+ name: "strip patch version for GoVersion",
+ prefix: "GoVersion",
+ counter: "go1.12.3",
+ want: "GoVersion:go1.12",
+ },
+ }
+
+ for _, tc := range testcases {
+ t.Run(tc.name, func(t *testing.T) {
+ got := normalizeCounterName(tc.prefix, tc.counter)
+ if tc.want != got {
+ t.Errorf("normalizeCounterName should return %s, got %s", tc.want, got)
+ }
+ })
+ }
+}

Change information

Files:
  • M godev/cmd/worker/main_test.go
Change size: M
Delta: 1 file changed, 55 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: telemetry
Gerrit-Branch: master
Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
Gerrit-Change-Number: 596475
Gerrit-PatchSet: 1
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
11:24 AM (10 hours ago) 11:24 AM
to goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Hongxiang Jiang voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: telemetry
Gerrit-Branch: master
Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
Gerrit-Change-Number: 596475
Gerrit-PatchSet: 1
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Wed, 03 Jul 2024 15:23:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Robert Findley (Gerrit)

unread,
12:01 PM (9 hours ago) 12:01 PM
to Hongxiang Jiang, goph...@pubsubhelper.golang.org, Go LUCI, Hyang-Ah Hana Kim, golang-co...@googlegroups.com
Attention needed from Hongxiang Jiang and Hyang-Ah Hana Kim

Robert Findley voted and added 1 comment

Votes added by Robert Findley

Code-Review+2

1 comment

File godev/cmd/worker/main_test.go
Line 557, Patchset 1 (Latest): t.Errorf("normalizeCounterName should return %s, got %s", tc.want, got)
Robert Findley . unresolved

This should follow the following advice for test error messages:
https://google.github.io/styleguide/go/decisions#identify-the-input
https://google.github.io/styleguide/go/decisions#got-before-want

So this could be written:

```
t.Errorf("normalizeCounterName(%q, %q) = %q, want %q", tc.prefix, tc.counter, got, tc.want)
```

Open in Gerrit

Related details

Attention is currently required from:
  • Hongxiang Jiang
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: telemetry
Gerrit-Branch: master
Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
Gerrit-Change-Number: 596475
Gerrit-PatchSet: 1
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Robert Findley <rfin...@google.com>
Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Wed, 03 Jul 2024 16:01:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
12:06 PM (9 hours ago) 12:06 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Hongxiang Jiang and Hyang-Ah Hana Kim

Hongxiang Jiang uploaded new patchset

Hongxiang Jiang uploaded patch set #2 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Hongxiang Jiang
  • Hyang-Ah Hana Kim
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 2
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hongxiang Jiang (Gerrit)

    unread,
    12:06 PM (9 hours ago) 12:06 PM
    to goph...@pubsubhelper.golang.org, Robert Findley, Go LUCI, Hyang-Ah Hana Kim, golang-co...@googlegroups.com
    Attention needed from Hyang-Ah Hana Kim

    Hongxiang Jiang voted and added 1 comment

    Votes added by Hongxiang Jiang

    Commit-Queue+1

    1 comment

    File godev/cmd/worker/main_test.go
    Line 557, Patchset 1: t.Errorf("normalizeCounterName should return %s, got %s", tc.want, got)
    Robert Findley . resolved

    This should follow the following advice for test error messages:
    https://google.github.io/styleguide/go/decisions#identify-the-input
    https://google.github.io/styleguide/go/decisions#got-before-want

    So this could be written:

    ```
    t.Errorf("normalizeCounterName(%q, %q) = %q, want %q", tc.prefix, tc.counter, got, tc.want)
    ```

    Hongxiang Jiang

    Done.
    Thanks for the pointer.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hyang-Ah Hana Kim
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Robert Findley <rfin...@google.com>
    Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Comment-Date: Wed, 03 Jul 2024 16:06:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Robert Findley <rfin...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hyang-Ah Hana Kim (Gerrit)

    unread,
    12:38 PM (9 hours ago) 12:38 PM
    to Hongxiang Jiang, goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, Robert Findley, Go LUCI, golang-co...@googlegroups.com
    Attention needed from Hongxiang Jiang

    Hyang-Ah Hana Kim voted Code-Review+2

    Code-Review+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hongxiang Jiang
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 2
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Robert Findley <rfin...@google.com>
    Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Comment-Date: Wed, 03 Jul 2024 16:38:52 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hongxiang Jiang (Gerrit)

    unread,
    3:40 PM (6 hours ago) 3:40 PM
    to goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, Robert Findley, Go LUCI, golang-co...@googlegroups.com

    Hongxiang Jiang voted Run-TryBot+1

    Run-TryBot+1
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedLegacy-TryBots-Pass
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 2
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Robert Findley <rfin...@google.com>
    Gerrit-Comment-Date: Wed, 03 Jul 2024 19:40:28 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hongxiang Jiang (Gerrit)

    unread,
    3:41 PM (6 hours ago) 3:41 PM
    to goph...@pubsubhelper.golang.org, Gopher Robot, Hyang-Ah Hana Kim, Robert Findley, Go LUCI, golang-co...@googlegroups.com

    Hongxiang Jiang voted and added 1 comment

    Votes added by Hongxiang Jiang

    Commit-Queue+1
    Run-TryBot+0

    1 comment

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Gopher Robot . resolved

    TryBots beginning. Status page: https://farmer.golang.org/try?commit=ab68aa4d

    Hongxiang Jiang

    Acknowledged

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 2
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Robert Findley <rfin...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Wed, 03 Jul 2024 19:40:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Gopher Robot <go...@golang.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hongxiang Jiang (Gerrit)

    unread,
    3:42 PM (6 hours ago) 3:42 PM
    to goph...@pubsubhelper.golang.org, Gopher Robot, Hyang-Ah Hana Kim, Robert Findley, Go LUCI, golang-co...@googlegroups.com

    Hongxiang Jiang voted Run-TryBot+1

    Run-TryBot+1
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedLegacy-TryBots-Pass
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 2
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Robert Findley <rfin...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Wed, 03 Jul 2024 19:42:41 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hongxiang Jiang (Gerrit)

    unread,
    4:00 PM (5 hours ago) 4:00 PM
    to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Gopher Robot, Hyang-Ah Hana Kim, Robert Findley, golang-co...@googlegroups.com

    Hongxiang Jiang submitted the change

    Change information

    Commit message:
    godev/cmd/worker: add unit test for normalizeCounterName
    Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Reviewed-by: Robert Findley <rfin...@google.com>
    Run-TryBot: Hongxiang Jiang <hxj...@golang.org>
    TryBot-Result: Gopher Robot <go...@golang.org>
    Reviewed-by: Hyang-Ah Hana Kim <hya...@gmail.com>
    Files:
    • M godev/cmd/worker/main_test.go
    Change size: M
    Delta: 1 file changed, 55 insertions(+), 0 deletions(-)
    Branch: refs/heads/master
    Submit Requirements:
    • requirement satisfiedCode-Review: +2 by Robert Findley, +2 by Hyang-Ah Hana Kim
    • requirement satisfiedLegacy-TryBots-Pass: TryBot-Result+1 by Gopher Robot, Run-TryBot+1 by Hongxiang Jiang
    • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: telemetry
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib3dd8bd9166b5ba5378a3cdd58fb4aba0e6ba672
    Gerrit-Change-Number: 596475
    Gerrit-PatchSet: 3
    Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages