Skip to content

Commit b0535f1

Browse files
author
Miral Gadani
committed
roachtest: suppress grafana link in issue help for non GCE
Epic: none Release note: None
1 parent 8c0426c commit b0535f1

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

pkg/cmd/roachtest/github.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
"github.com/cockroachdb/cockroach/pkg/cmd/internal/issues"
2020
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
21+
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/spec"
2122
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
2223
"github.com/cockroachdb/cockroach/pkg/internal/team"
2324
rperrors "github.com/cockroachdb/cockroach/pkg/roachprod/errors"
@@ -49,7 +50,7 @@ func roachtestPrefix(p string) string {
4950

5051
// generateHelpCommand creates a HelpCommand for createPostRequest
5152
func generateHelpCommand(
52-
clusterName string, start time.Time, end time.Time,
53+
clusterName string, cloud string, start time.Time, end time.Time,
5354
) func(renderer *issues.Renderer) {
5455
return func(renderer *issues.Renderer) {
5556
issues.HelpCommandAsLink(
@@ -60,8 +61,9 @@ func generateHelpCommand(
6061
"How To Investigate (internal)",
6162
"https://cockroachlabs.atlassian.net/l/c/SSSBr8c7",
6263
)(renderer)
63-
// An empty clusterName corresponds to a cluster creation failure
64-
if clusterName != "" {
64+
// An empty clusterName corresponds to a cluster creation failure.
65+
// We only scrape metrics from GCE clusters for now.
66+
if spec.GCE == cloud && clusterName != "" {
6567
issues.HelpCommandAsLink(
6668
"Grafana",
6769
fmt.Sprintf("https://go.crdb.dev/p/roachfana/%s/%d/%d", clusterName, start.UnixMilli(), end.UnixMilli()),
@@ -223,7 +225,7 @@ func (g *githubIssues) createPostRequest(
223225
Artifacts: artifacts,
224226
ExtraLabels: labels,
225227
ExtraParams: clusterParams,
226-
HelpCommand: generateHelpCommand(issueClusterName, start, end),
228+
HelpCommand: generateHelpCommand(issueClusterName, spec.Cluster.Cloud, start, end),
227229
}, nil
228230
}
229231

pkg/cmd/roachtest/github_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,14 @@ func TestGenerateHelpCommand(t *testing.T) {
111111
end := time.Date(2023, time.July, 21, 16, 42, 13, 137, time.UTC)
112112

113113
r := &issues.Renderer{}
114-
generateHelpCommand("foo-cluster", start, end)(r)
114+
generateHelpCommand("foo-cluster", spec.GCE, start, end)(r)
115115

116116
echotest.Require(t, r.String(), filepath.Join("testdata", "help_command.txt"))
117+
118+
r = &issues.Renderer{}
119+
generateHelpCommand("foo-cluster", spec.AWS, start, end)(r)
120+
121+
echotest.Require(t, r.String(), filepath.Join("testdata", "help_command_non_gce.txt"))
117122
}
118123

119124
func TestCreatePostRequest(t *testing.T) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
echo
2+
----
3+
----
4+
5+
6+
See: [roachtest README](https://github.com/cockroachdb/cockroach/blob/master/pkg/cmd/roachtest/README.md)
7+
8+
9+
10+
See: [How To Investigate \(internal\)](https://cockroachlabs.atlassian.net/l/c/SSSBr8c7)
11+
12+
----
13+
----

0 commit comments

Comments
 (0)