Skip to content

Commit 60804c6

Browse files
committed
rttanalysis: deflake BenchmarkJobs
The benchmark started failing since the code doesn't handle a nil table descriptor. The fix is to create a dummy descriptor in the job payload details. Release note: None
1 parent 9bcc3fd commit 60804c6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pkg/bench/rttanalysis/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ go_test(
6565
"//pkg/security/username",
6666
"//pkg/server",
6767
"//pkg/server/serverpb",
68+
"//pkg/sql/catalog/descpb",
6869
"//pkg/testutils/pgurlutils",
6970
"//pkg/testutils/serverutils",
7071
"//pkg/testutils/skip",

pkg/bench/rttanalysis/jobs_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,27 @@ import (
1414
"github.com/cockroachdb/cockroach/pkg/security/username"
1515
"github.com/cockroachdb/cockroach/pkg/server"
1616
"github.com/cockroachdb/cockroach/pkg/server/serverpb"
17+
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
1718
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
1819
)
1920

2021
func BenchmarkJobs(b *testing.B) { reg.Run(b) }
2122
func init() {
23+
// Create a minimal table descriptor for the import job.
24+
tableDesc := &descpb.TableDescriptor{
25+
ID: 100,
26+
ParentID: 1,
27+
Name: "benchmark_table",
28+
FormatVersion: descpb.InterleavedFormatVersion,
29+
Version: 1,
30+
}
31+
2232
payloadBytes, err := protoutil.Marshal(&jobspb.Payload{
23-
Details: jobspb.WrapPayloadDetails(jobspb.ImportDetails{}),
33+
Details: jobspb.WrapPayloadDetails(jobspb.ImportDetails{
34+
Table: jobspb.ImportDetails_Table{
35+
Desc: tableDesc,
36+
},
37+
}),
2438
UsernameProto: username.RootUserName().EncodeProto(),
2539
})
2640
if err != nil {

0 commit comments

Comments
 (0)