Skip to content

Commit

Permalink
Merge #109589
Browse files Browse the repository at this point in the history
109589: roachtest: add O-rsg to random syntax tests r=mgartner a=mgartner

The `O-rsg` label is now applied to issues created when a test with
randomized SQL syntax fails: sqlsmith, TLP, costfuzz, and unoptimized
query oracle tests.

Epic: None

Release note: None


Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
  • Loading branch information
craig[bot] and mgartner committed Aug 29, 2023
2 parents fa4f9ba + 9d31864 commit e04c45c
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 5 deletions.
3 changes: 3 additions & 0 deletions pkg/cmd/roachtest/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ func (g *githubIssues) createPostRequest(
} else if !spec.NonReleaseBlocker {
labels = append(labels, "release-blocker")
}
if len(spec.ExtraLabels) > 0 {
labels = append(labels, spec.ExtraLabels...)
}

teams, err := g.teamLoader()
if err != nil {
Expand Down
27 changes: 22 additions & 5 deletions pkg/cmd/roachtest/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ func TestCreatePostRequest(t *testing.T) {
clusterCreationFailed bool
loadTeamsFailed bool
localSSD bool
extraLabels []string
arch vm.CPUArch
failure failure
expectedPost bool
expectedReleaseBlocker bool
expectedSkipTestFailure bool
expectedParams map[string]string
}{
{true, false, false, false, "", createFailure(errors.New("other")), true, false, false,
{true, false, false, false, nil, "", createFailure(errors.New("other")), true, false, false,
prefixAll(map[string]string{
"cloud": "gce",
"encrypted": "false",
Expand All @@ -149,7 +150,7 @@ func TestCreatePostRequest(t *testing.T) {
"localSSD": "false",
}),
},
{true, false, false, true, vm.ArchARM64, createFailure(errClusterProvisioningFailed), true, false, true,
{true, false, false, true, nil, vm.ArchARM64, createFailure(errClusterProvisioningFailed), true, false, true,
prefixAll(map[string]string{
"cloud": "gce",
"encrypted": "false",
Expand All @@ -164,17 +165,29 @@ func TestCreatePostRequest(t *testing.T) {
// !nonReleaseBlocker and issue is an SSH flake. Also ensure that
// in the event of a failed cluster creation, nil `vmOptions` and
// `clusterImpl` are not dereferenced
{false, true, false, false, "", createFailure(rperrors.ErrSSH255), true, false, true,
{false, true, false, false, nil, "", createFailure(rperrors.ErrSSH255), true, false, true,
prefixAll(map[string]string{
"cloud": "gce",
"ssd": "0",
"cpu": "4",
}),
},
//Simulate failure loading TEAMS.yaml
{true, false, true, false, "", createFailure(errors.New("other")), false, false, false, nil},
{true, false, true, false, nil, "", createFailure(errors.New("other")), false, false, false, nil},
//Error during post test assertions
{true, false, false, false, "", createFailure(errDuringPostAssertions), false, false, false, nil},
{true, false, false, false, nil, "", createFailure(errDuringPostAssertions), false, false, false, nil},
// Assert that extra labels in the test spec are added to the issue.
{true, false, false, false, []string{"foo-label"}, "", createFailure(errors.New("other")), true, false, false,
prefixAll(map[string]string{
"cloud": "gce",
"encrypted": "false",
"fs": "ext4",
"ssd": "0",
"cpu": "4",
"arch": "amd64",
"localSSD": "false",
}),
},
}

reg := makeTestRegistry(spec.GCE, "", "", false, false)
Expand All @@ -187,6 +200,7 @@ func TestCreatePostRequest(t *testing.T) {
Owner: OwnerUnitTest,
Cluster: clusterSpec,
NonReleaseBlocker: c.nonReleaseBlocker,
ExtraLabels: c.extraLabels,
}

ti := &testImpl{
Expand Down Expand Up @@ -238,6 +252,9 @@ func TestCreatePostRequest(t *testing.T) {
}

require.True(t, contains(req.ExtraLabels, nil, "O-roachtest"))
for _, l := range c.extraLabels {
require.True(t, contains(req.ExtraLabels, nil, l), "expected extra label %q", l)
}
require.Equal(t, c.expectedReleaseBlocker, contains(req.ExtraLabels, nil, "release-blocker"))
require.Equal(t, c.expectedSkipTestFailure, req.SkipLabelTestFailure)

Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/roachtest/registry/test_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ type TestSpec struct {
// fingerprint, i.e. the node count, the version, etc. that appear in the
// infix. This will get rid of this awkward prefix naming restriction.
SnapshotPrefix string

// ExtraLabels are test-specific labels that will be added to the Github
// issue created when a failure occurs, in addition to default labels.
ExtraLabels []string
}

// PostValidation is a type of post-validation that runs after a test completes.
Expand Down
17 changes: 17 additions & 0 deletions pkg/cmd/roachtest/testdata/help_command_createpost_6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
echo
----
----


See: [roachtest README](https://github.com/cockroachdb/cockroach/blob/master/pkg/cmd/roachtest/README.md)



See: [How To Investigate \(internal\)](https://cockroachlabs.atlassian.net/l/c/SSSBr8c7)



See: [Grafana](https://go.crdb.dev/p/roachfana/foo/1689957243000/1689957733000)

----
----
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/costfuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func registerCostFuzz(r registry.Registry) {
name: "costfuzz", setupName: setupName, run: runCostFuzzQuery,
})
},
ExtraLabels: []string{"O-rsg"},
})
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/sqlsmith.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version;
}
runSQLSmith(ctx, t, c, setup, setting)
},
ExtraLabels: []string{"O-rsg"},
})
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/tlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func registerTLP(r registry.Registry) {
Leases: registry.MetamorphicLeases,
NativeLibs: registry.LibGEOS,
Run: runTLP,
ExtraLabels: []string{"O-rsg"},
})
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/unoptimized_query_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func registerUnoptimizedQueryOracle(r registry.Registry) {
},
})
},
ExtraLabels: []string{"O-rsg"},
})
}
}
Expand Down

0 comments on commit e04c45c

Please sign in to comment.