-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
63831: roachtest: add roachtest against pg ruby driver r=rafiss a=RichardJCai roachtest: add roachtest against pg ruby driver Release note: None Resolves #62472 64732: bazel: upgrade to bazel 4.0.0 in the builder image r=rail a=rickystewart This will allow us to pick up the latest version of `rules_foreign_cc`, (for example, for #64334) which doesn't build with an earlier bazel (#64709). Also make sure the version assertion in `WORKSPACE` is up-to-date. Release note: None 64745: bazel: use a wildcard instead of listing every stringer file for gazelle r=rail a=rickystewart This excludes a single non-stringer file, `pkg/sql/sem/tree/parse_string.go`, so re-include it and mark it `# keep`. Release note: None 64766: sql: fix the session tracing in some cases r=yuzefovich a=yuzefovich When the session tracing is started, we might need to start two tracing spans: we always start a span for the connection, but also if we're inside of a txn, we start a separate span for the txn. Previously, the span of the previous txn wasn't properly cleaned up when the session tracing is started again outside of a txn, which resulted in old (irrelevant) entries being added to the newer trace. Now this is fixed. Additionally, this commit makes sure to finish the tracing spans (which wasn't done previously). Fixes: #59203. Fixes: #60672. Release note (bug fix): Previously, the session trace (i.e. `SHOW TRACE FOR SESSION`) could contain entries that corresponded to the previous trace (i.e. `SET TRACING=ON` didn't properly reset the trace). Now this is fixed. 64775: changefeedccl: add test for disabled outbound IO r=HonoreDB a=stevendanna This adds a test to ensure that we do not allow sinkful changefeeds to be started when the --external-io-disabled flag has been set. Note that this only tests a single node setup. For the flag to be effective, it needs to be set on all nodes in a cluster. Release note: None Co-authored-by: richardjcai <caioftherichard@gmail.com> Co-authored-by: Ricky Stewart <ricky@cockroachlabs.com> Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com> Co-authored-by: Steven Danna <danna@cockroachlabs.com>
- Loading branch information
Showing
17 changed files
with
914 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
// Copyright 2021 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package main | ||
|
||
import ( | ||
"bufio" | ||
"bytes" | ||
"context" | ||
"fmt" | ||
"regexp" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/util/log" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var rubyPGTestFailureRegex = regexp.MustCompile(`^rspec ./.*# .*`) | ||
var rubyPGVersion = "v1.2.3" | ||
|
||
// This test runs Ruby PG's full test suite against a single cockroach node. | ||
func registerRubyPG(r *testRegistry) { | ||
runRubyPGTest := func( | ||
ctx context.Context, | ||
t *test, | ||
c *cluster, | ||
) { | ||
if c.isLocal() { | ||
t.Fatal("cannot be run in local mode") | ||
} | ||
node := c.Node(1) | ||
t.Status("setting up cockroach") | ||
c.Put(ctx, cockroach, "./cockroach", c.All()) | ||
if err := c.PutLibraries(ctx, "./lib"); err != nil { | ||
t.Fatal(err) | ||
} | ||
c.Start(ctx, t, c.All()) | ||
|
||
version, err := fetchCockroachVersion(ctx, c, node[0], nil) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := alterZoneConfigAndClusterSettings(ctx, version, c, node[0], nil); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
t.Status("cloning rails and installing prerequisites") | ||
|
||
c.l.Printf("Supported ruby-pg version is %s.", rubyPGVersion) | ||
|
||
if err := repeatRunE( | ||
ctx, c, node, "update apt-get", `sudo apt-get -qq update`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := repeatRunE( | ||
ctx, | ||
c, | ||
node, | ||
"install dependencies", | ||
`sudo apt-get -qq install ruby-full ruby-dev rubygems build-essential zlib1g-dev libpq-dev libsqlite3-dev`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := repeatRunE( | ||
ctx, | ||
c, | ||
node, | ||
"install ruby 2.7", | ||
`mkdir -p ruby-install && \ | ||
curl -fsSL https://github.com/postmodern/ruby-install/archive/v0.6.1.tar.gz | tar --strip-components=1 -C ruby-install -xz && \ | ||
sudo make -C ruby-install install && \ | ||
sudo ruby-install --system ruby 2.7.1 && \ | ||
sudo gem update --system`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := repeatRunE( | ||
ctx, c, node, "remove old ruby-pg", `sudo rm -rf /mnt/data1/ruby-pg`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := repeatGitCloneE( | ||
ctx, | ||
t.l, | ||
c, | ||
"https://github.com/ged/ruby-pg.git", | ||
"/mnt/data1/ruby-pg", | ||
rubyPGVersion, | ||
node, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
t.Status("installing bundler") | ||
if err := repeatRunE( | ||
ctx, | ||
c, | ||
node, | ||
"installing bundler", | ||
`cd /mnt/data1/ruby-pg/ && sudo gem install bundler:2.1.4`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
t.Status("installing gems") | ||
if err := repeatRunE( | ||
ctx, | ||
c, | ||
node, | ||
"installing gems", | ||
`cd /mnt/data1/ruby-pg/ && sudo bundle install`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := repeatRunE( | ||
ctx, c, node, "remove old ruby-pg helpers.rb", `sudo rm /mnt/data1/ruby-pg/spec/helpers.rb`, | ||
); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// Write the cockroach config into the test suite to use. | ||
err = c.PutE(ctx, c.l, "./pkg/cmd/roachtest/ruby_pg_helpers.rb", "/mnt/data1/ruby-pg/spec/helpers.rb", c.All()) | ||
require.NoError(t, err) | ||
|
||
t.Status("running ruby-pg test suite") | ||
// Note that this is expected to return an error, since the test suite | ||
// will fail. And it is safe to swallow it here. | ||
rawResults, _ := c.RunWithBuffer(ctx, t.l, node, | ||
`cd /mnt/data1/ruby-pg/ && sudo rake`, | ||
) | ||
|
||
c.l.Printf("Test Results:\n%s", rawResults) | ||
|
||
// Find all the failed and errored tests. | ||
results := newORMTestsResults() | ||
blocklistName, expectedFailures, _, _ := rubyPGBlocklist.getLists(version) | ||
if expectedFailures == nil { | ||
t.Fatalf("No ruby-pg blocklist defined for cockroach version %s", version) | ||
} | ||
|
||
scanner := bufio.NewScanner(bytes.NewReader(rawResults)) | ||
for scanner.Scan() { | ||
match := rubyPGTestFailureRegex.FindStringSubmatch(scanner.Text()) | ||
if match == nil { | ||
continue | ||
} | ||
if len(match) != 1 { | ||
log.Fatalf(ctx, "expected one match for test name, found: %d", len(match)) | ||
} | ||
|
||
// Take the first test name. | ||
test := match[0] | ||
|
||
// This regex is used to get the name of the test. | ||
// The test name follows the file name and a hashtag. | ||
// ie. test.rb:99 # TEST NAME. | ||
strs := regexp.MustCompile("^rspec .*.rb.*([0-9]|]) # ").Split(test, -1) | ||
if len(strs) != 2 { | ||
log.Fatalf(ctx, "expected test output line to be split into two strings") | ||
} | ||
test = strs[1] | ||
|
||
issue, expectedFailure := expectedFailures[test] | ||
switch { | ||
case expectedFailure: | ||
results.results[test] = fmt.Sprintf("--- FAIL: %s - %s (expected)", | ||
test, maybeAddGithubLink(issue), | ||
) | ||
results.failExpectedCount++ | ||
results.currentFailures = append(results.currentFailures, test) | ||
case !expectedFailure: | ||
results.results[test] = fmt.Sprintf("--- PASS: %s - %s (unexpected)", | ||
test, maybeAddGithubLink(issue), | ||
) | ||
} | ||
results.runTests[test] = struct{}{} | ||
} | ||
|
||
results.summarizeAll(t, "ruby-pg", blocklistName, expectedFailures, version, rubyPGVersion) | ||
} | ||
|
||
r.Add(testSpec{ | ||
MinVersion: "v20.1.0", | ||
Name: "ruby-pg", | ||
Owner: OwnerSQLExperience, | ||
Cluster: makeClusterSpec(1), | ||
Tags: []string{`default`, `orm`}, | ||
Run: func(ctx context.Context, t *test, c *cluster) { | ||
runRubyPGTest(ctx, t, c) | ||
}, | ||
}) | ||
} |
Oops, something went wrong.