Skip to content

Commit

Permalink
testutils: move sideeye helper to its own package
Browse files Browse the repository at this point in the history
This being directly present in `pkg/testutils` meant that `side-eye` is
directly linked into `cockroach`, which was not intentional. It also
made `cockroach` impossible to build for `s390x` as `side-eye` doesn't
support it. Since the helper is unused, we can just move the helper to
its own package.

Epic: CRDB-21133
Release note: None
  • Loading branch information
rickystewart committed Feb 11, 2025
1 parent 004b3d4 commit 1b5b9f6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,7 @@ GO_TARGETS = [
"//pkg/testutils/serverutils/regionlatency:regionlatency",
"//pkg/testutils/serverutils:serverutils",
"//pkg/testutils/serverutils:serverutils_test",
"//pkg/testutils/sideeye:sideeye",
"//pkg/testutils/skip:skip",
"//pkg/testutils/sqlutils:sqlutils",
"//pkg/testutils/sqlutils:sqlutils_test",
Expand Down
3 changes: 0 additions & 3 deletions pkg/testutils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ go_library(
"keys.go",
"net.go",
"pprof.go",
"sideeye.go",
"soon.go",
"sort.go",
"subtest.go",
Expand All @@ -33,9 +32,7 @@ go_library(
"//pkg/util/syncutil",
"//pkg/util/timeutil",
"@com_github_cockroachdb_errors//:errors",
"@com_github_dataexmachina_dev_side_eye_go//sideeye",
"@com_github_petermattis_goid//:goid",
"@com_github_stretchr_testify//require",
],
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func TestLint(t *testing.T) {
":!acceptance/test_acceptance.go", // For COCKROACH_RUN_ACCEPTANCE
":!compose/compare/compare/compare_test.go", // For COCKROACH_RUN_COMPOSE_COMPARE
":!compose/compose_test.go", // For COCKROACH_RUN_COMPOSE
":!testutils/sideeye.go", // For SIDE_EYE_API_TOKEN
":!testutils/sideeye/sideeye.go", // For SIDE_EYE_API_TOKEN
},
},
} {
Expand Down
14 changes: 14 additions & 0 deletions pkg/testutils/sideeye/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "sideeye",
srcs = ["sideeye.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/testutils/sideeye",
visibility = ["//visibility:public"],
deps = [
"//pkg/testutils",
"@com_github_cockroachdb_errors//:errors",
"@com_github_dataexmachina_dev_side_eye_go//sideeye",
"@com_github_stretchr_testify//require",
],
)
5 changes: 3 additions & 2 deletions pkg/testutils/sideeye.go → pkg/testutils/sideeye/sideeye.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
"time"

"github.com/DataExMachina-dev/side-eye-go/sideeye"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/require"
)

type testingT interface {
require.TestingT
TestFatalerLogger
testutils.TestFatalerLogger
}

// CaptureSideEyeSnapshot captures a Side-Eye snapshot if the
Expand All @@ -39,7 +40,7 @@ func CaptureSideEyeSnapshot(ctx context.Context, t testingT) {
require.NoError(t, err)

var name string
if t, ok := t.(TestNamedFatalerLogger); ok {
if t, ok := t.(testutils.TestNamedFatalerLogger); ok {
name = t.Name()
} else {
name = "unknown test"
Expand Down

0 comments on commit 1b5b9f6

Please sign in to comment.