-
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.
86662: ci: add scripting to generate declarative schema changer corpus r=fqazi a=fqazi These changes do the following: Informs: #82643 1. Add a test case for validating schema changer corpuses back into master (was accidentally cloberred) 2. Extend logictest to run certain tests in a mixed version test that are interesting from a declarative schema changer viewpoint (we will extend this more) 3. More importantly for the dev-infra team an initial approach to collect declarative schema changer states from logictest during nightly builds. The scripts included here will generate a corpus and upload them to GCS storage for a nightly build. Release justification: low risk changes to add scripting for nightly artifacts to allow us to do mixed version testing for the declarative schema changer Co-authored-by: Faizan Qazi <[email protected]>
- Loading branch information
Showing
17 changed files
with
334 additions
and
4 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
build/teamcity/cockroach/nightlies/sqllogic_corpus_nightly.sh
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))" | ||
|
||
source "$dir/teamcity-support.sh" # For $root | ||
source "$dir/teamcity-bazel-support.sh" # For run_bazel | ||
|
||
tc_start_block "Run SQL Logic Test with Declarative Corpus Generation" | ||
BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e TC_BUILD_BRANCH -e GITHUB_API_TOKEN -e GOOGLE_EPHEMERAL_CREDENTIALS -e BUILD_VCS_NUMBER -e TC_BUILD_ID -e TC_SERVER_URL" \ | ||
run_bazel build/teamcity/cockroach/nightlies/sqllogic_corpus_nightly_impl.sh | ||
tc_end_block "Run SQL Logic Test High VModule" |
166 changes: 166 additions & 0 deletions
166
build/teamcity/cockroach/nightlies/sqllogic_corpus_nightly_impl.sh
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,166 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xeuo pipefail | ||
|
||
dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))" | ||
source "$dir/teamcity-bazel-support.sh" # For process_test_json | ||
source "$dir/teamcity-support.sh" # For process_test_json | ||
|
||
bazel build //pkg/cmd/bazci //pkg/cmd/github-post //pkg/cmd/testfilter --config=ci | ||
BAZEL_BIN=$(bazel info bazel-bin --config=ci) | ||
google_credentials="$GOOGLE_EPHEMERAL_CREDENTIALS" | ||
|
||
log_into_gcloud | ||
|
||
ARTIFACTS_DIR=/artifacts | ||
GO_TEST_JSON_OUTPUT_FILE=$ARTIFACTS_DIR/test.json.txt | ||
GO_TEST_GEN_JSON_OUTPUT_FILE=$ARTIFACTS_DIR/test-gen.json.txt | ||
GO_TEST_GEN_CCL_JSON_OUTPUT_FILE=$ARTIFACTS_DIR/test-gen-ccl.json.txt | ||
GO_TEST_VALIDATE_JSON_OUTPUT_FILE=$ARTIFACTS_DIR/test-validate.json.txt | ||
GO_TEST_JSON_OUTPUT_FILE_MIXED=$ARTIFACTS_DIR/test-mixed.json.txt | ||
GO_TEST_VALIDATE_JSON_OUTPUT_FILE_MIXED=$ARTIFACTS_DIR/test-validate-mixed.json.txt | ||
|
||
mkdir -p $ARTIFACTS_DIR/corpus | ||
mkdir -p $ARTIFACTS_DIR/corpus-mixed | ||
exit_status=0 | ||
|
||
# Generate a corpus for all non-mixed version variants | ||
for config in local multiregion-9node-3region-3azs; do | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci -- --config=ci \ | ||
test //pkg/sql/logictest/tests/$config/... \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus \ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_JSON_OUTPUT_FILE.$config \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_JSON_OUTPUT_FILE.$config \ | ||
$exit_status | ||
done | ||
|
||
for config in local multiregion-9node-3region-3azs multiregion-9node-3region-3azs-no-los multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-vec-off multiregion-15node-5region-3azs 3node-tenant 3node-tenant-multiregion; do | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci \ | ||
test //pkg/ccl/logictestccl/tests/$config/... -- \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus \ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_JSON_OUTPUT_FILE.$config \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_JSON_OUTPUT_FILE.$config \ | ||
$exit_status | ||
done | ||
|
||
# Generate corpuses from end-to-end-schema changer tests | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci \ | ||
test //pkg/sql/schemachanger:schemachanger_test -- \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus \ | ||
--test_filter='^TestGenerateCorpus.*$' \ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_GEN_JSON_OUTPUT_FILE \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_GEN_JSON_OUTPUT_FILE \ | ||
$exit_status | ||
|
||
# Generate corpuses from end-to-end-schema changer tests | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci \ | ||
test //pkg/ccl/schemachangerccl:schemachangerccl_test -- \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus \ | ||
--test_filter='^TestGenerateCorpus.*$' \ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_GEN_CCL_JSON_OUTPUT_FILE \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_GEN_CCL_JSON_OUTPUT_FILE \ | ||
$exit_status | ||
|
||
|
||
# Any generated corpus should be validated on the current version first, which | ||
# indicates we can replay it on the same version. | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci \ | ||
test //pkg/sql/schemachanger/corpus:corpus_test -- \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus \ | ||
--test_filter='^TestValidateCorpuses$' \ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_VALIDATE_JSON_OUTPUT_FILE \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_VALIDATE_JSON_OUTPUT_FILE \ | ||
$exit_status | ||
|
||
# If validation passes its safe to update the copy in storage. | ||
if [ $exit_status = 0 ]; then | ||
gsutil cp $ARTIFACTS_DIR/corpus/* gs://cockroach-corpus/corpus-$TC_BUILD_BRANCH/ | ||
fi | ||
|
||
# Generate a corpus for all mixed version variants | ||
for config in local-mixed-22.1-22.2; do | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci \ | ||
test //pkg/sql/logictest/tests/$config/... -- \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus-mixed\ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_JSON_OUTPUT_FILE_MIXED.$config \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_JSON_OUTPUT_FILE_MIXED.$config \ | ||
$exit_status | ||
done | ||
|
||
# Any generated corpus should be validated on the current version first, which | ||
# indicates we can replay it on the same version. | ||
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci \ | ||
test //pkg/sql/schemachanger/corpus:corpus_test -- \ | ||
--test_arg=--declarative-corpus=$ARTIFACTS_DIR/corpus-mixed \ | ||
--test_filter='^TestValidateCorpuses$' \ | ||
--test_env=GO_TEST_WRAP_TESTV=1 \ | ||
--test_env=GO_TEST_WRAP=1 \ | ||
--test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_VALIDATE_JSON_OUTPUT_FILE_MIXED \ | ||
--test_timeout=7200 \ | ||
|| exit_status=$? | ||
|
||
process_test_json \ | ||
$BAZEL_BIN/pkg/cmd/testfilter/testfilter_/testfilter \ | ||
$BAZEL_BIN/pkg/cmd/github-post/github-post_/github-post \ | ||
$ARTIFACTS_DIR \ | ||
$GO_TEST_VALIDATE_JSON_OUTPUT_FILE_MIXED \ | ||
$exit_status | ||
|
||
# If validation passes its safe to update the copy in storage. | ||
if [ $exit_status = 0 ]; then | ||
gsutil cp $ARTIFACTS_DIR/corpus-mixed/* gs://cockroach-corpus/corpus-mixed-$TC_BUILD_BRANCH/ | ||
fi |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# LogicTest: default-configs local-mixed-22.1-22.2 | ||
|
||
statement ok | ||
CREATE TABLE t ( | ||
a INT PRIMARY KEY, | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# LogicTest: default-configs local-mixed-22.1-22.2 | ||
|
||
statement ok | ||
CREATE TABLE users ( | ||
id INT PRIMARY KEY, | ||
|
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# LogicTest: !local-legacy-schema-changer | ||
|
||
# Test dropping nothing. | ||
statement ok | ||
DROP OWNED BY testuser | ||
|
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
|
||
# LogicTest: default-configs local-mixed-22.1-22.2 | ||
|
||
# see also file `sequences` | ||
|
||
statement ok | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# LogicTest: default-configs local-mixed-22.1-22.2 | ||
|
||
statement ok | ||
CREATE TABLE a (k STRING PRIMARY KEY, v STRING) | ||
|
||
|
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
63 changes: 63 additions & 0 deletions
63
pkg/sql/logictest/tests/local-mixed-22.1-22.2/generated_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.