From 1e4479947ff23bd62115ba955da0d8038477e1a8 Mon Sep 17 00:00:00 2001 From: Jean-Hadrien Chabran Date: Fri, 21 Apr 2023 14:39:36 +0200 Subject: [PATCH] Port back compat tests to Bazel (#50932) Clones and patches Sourcegraph git repository under @sourcegraph_back_compat so we can run tests targets from that particular release against the new database schema. Flakes can be defined to skip known problematic tests which are either flaky or simply cannot run against the new schema in case of a breaking change. See //dev/backcompat:flakes.bzl for more details about how to define them. The final result is the definition of a @sourcegraph_back_compat target, whose test targets are exactly the same as back then, but with instead a new schema. Example: `bazel test @sourcegraph_back_compat//enterprise/internal/batches/...`. See https://github.com/sourcegraph/sourcegraph/pull/50932/files#diff-2f07315ec320aa4080768fec54f32ebb2cbf4e3e6df7c51a314beda827c48c41R104 for the command generating the mandatory patch file in CI for these tests to run. If the patch file were to be missing, a placeholder diff is in place to make it explicit (in the eventuality of someone running those locally). A new CI job has been added because this one is fully independent from the other targets to build, and will be cached most of the time. Depending how it goes, I might bring that one over the main bazel job to avoid getting an agent just for that. Because it's cached, we can run this within PRs and have it take 10s max for 99% of the PRs and main builds. TODO: The flakefiles are still there, they're just defined in different place. I need to port the annotation as well, that has proven to be really useful. Also right now it's a bit manual as the 5.0.0 target is a bit peculiar, but that'll get much simpler as we progress, as the next old release will be requiring less and less patching. This turns about a dozen of 10m individual jobs into a single one ranging from 30s if there's not database changes to 10m if there's some of them and cold cache. ## Test plan QA: fails on old code when a new migration breaks something: - https://buildkite.com/sourcegraph/sourcegraph/builds/214283#01879f2d-67be-4caf-b5d5-93f045e19348/118-126 --- .gitignore | 4 + WORKSPACE | 3 + dev/backcompat/BUILD.bazel | 0 dev/backcompat/defs.bzl | 133 +++++++++ dev/backcompat/flakes.bzl | 17 ++ dev/backcompat/patches/BUILD.bazel | 4 + .../patches/back_compat_migrations.patch | 3 + dev/backcompat/test_release_version.bzl | 13 + dev/ci/go-backcompat/BUILD.bazel | 20 -- dev/ci/go-backcompat/README.md | 15 - dev/ci/go-backcompat/flakefiles/.gitkeep | 1 - dev/ci/go-backcompat/flakefiles/v3.35.0.json | 12 - dev/ci/go-backcompat/flakefiles/v3.37.0.json | 12 - dev/ci/go-backcompat/flakefiles/v3.38.0.json | 22 -- dev/ci/go-backcompat/flakefiles/v3.39.0.json | 27 -- dev/ci/go-backcompat/flakefiles/v3.40.0.json | 32 --- dev/ci/go-backcompat/flakefiles/v3.41.0.json | 77 ----- dev/ci/go-backcompat/flakefiles/v3.42.0.json | 52 ---- dev/ci/go-backcompat/flakefiles/v3.43.0.json | 262 ------------------ dev/ci/go-backcompat/flakefiles/v4.0.0.json | 12 - dev/ci/go-backcompat/flakefiles/v4.1.0.json | 58 ---- dev/ci/go-backcompat/flakefiles/v4.2.0.json | 57 ---- dev/ci/go-backcompat/flakefiles/v4.3.0.json | 82 ------ dev/ci/go-backcompat/flakefiles/v4.4.0.json | 142 ---------- dev/ci/go-backcompat/flakefiles/v4.5.0.json | 52 ---- dev/ci/go-backcompat/reorganize.go | 62 ----- dev/ci/go-backcompat/test.sh | 165 ----------- .../background-information/ci/reference.md | 48 ++-- .../dev/ci/internal/ci/bazel_operations.go | 29 ++ enterprise/dev/ci/internal/ci/operations.go | 24 -- 30 files changed, 227 insertions(+), 1213 deletions(-) create mode 100644 dev/backcompat/BUILD.bazel create mode 100644 dev/backcompat/defs.bzl create mode 100644 dev/backcompat/flakes.bzl create mode 100644 dev/backcompat/patches/BUILD.bazel create mode 100644 dev/backcompat/patches/back_compat_migrations.patch create mode 100644 dev/backcompat/test_release_version.bzl delete mode 100644 dev/ci/go-backcompat/BUILD.bazel delete mode 100644 dev/ci/go-backcompat/README.md delete mode 100644 dev/ci/go-backcompat/flakefiles/.gitkeep delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.35.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.37.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.38.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.39.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.40.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.41.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.42.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v3.43.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v4.0.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v4.1.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v4.2.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v4.3.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v4.4.0.json delete mode 100644 dev/ci/go-backcompat/flakefiles/v4.5.0.json delete mode 100644 dev/ci/go-backcompat/reorganize.go delete mode 100755 dev/ci/go-backcompat/test.sh diff --git a/.gitignore b/.gitignore index 73684663a2f..9cd7a35d267 100644 --- a/.gitignore +++ b/.gitignore @@ -189,3 +189,7 @@ index.scip /an /tr /cache-*.tar + +# Backward compatibility database tests patch, generated on the fly in CI +# for `bazel test @sourcegraph_back_compat//...` targets. +/dev/backcompat/back_compat_migrations.patch diff --git a/WORKSPACE b/WORKSPACE index dc7d21f49bc..8adb19fce52 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -251,3 +251,6 @@ crates_repository( load("@crate_index//:defs.bzl", "crate_repositories") crate_repositories() + +load("//dev/backcompat:defs.bzl", "back_compat_defs") +back_compat_defs() diff --git a/dev/backcompat/BUILD.bazel b/dev/backcompat/BUILD.bazel new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/backcompat/defs.bzl b/dev/backcompat/defs.bzl new file mode 100644 index 00000000000..f69eab0bd90 --- /dev/null +++ b/dev/backcompat/defs.bzl @@ -0,0 +1,133 @@ +"""Database schema backward compatibility definitions. + +Clones and patches Sourcegraph git repository under @sourcegraph_back_compat so we can run tests targets +from that particular release against the new database schema. + +Flakes can be defined to skip known problematic tests which are either flaky or simply cannot run against +the new schema in case of a breaking change. See //dev/backcompat:flakes.bzl for more details about +how to define them. + +The final result is the definition of a @sourcegraph_back_compat target, whose test targets are exactly +the same as back then, but with instead a new schema. + +Example: `bazel test @sourcegraph_back_compat//enterprise/internal/batches/...`. + +See https://sourcegraph.com/search?q=context:global+dev/backcompat/patches/back_compat_migrations.patch+repo:github.com/sourcegraph/sourcegraph+lang:Go&patternType=standard&sm=0&groupBy=repo +for the command generating the mandatory patch file in CI for these tests to run. + +If the patch file were to be missing, a placeholder diff is in place to make it explicit (in the +eventuality of someone running those locally). +""" + +load("test_release_version.bzl", "MINIMUM_UPGRADEABLE_VERSION", "MINIMUM_UPGRADEABLE_VERSION_REF") +load("flakes.bzl", "FLAKES") + +load("@bazel_gazelle//:deps.bzl", "go_repository") +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +# Shell snippet to disable a test on the fly. Needs to be formatted before being used. +# +# OSX ships BSD sed and the GNU sed that is traditionally available on Linux is named gsed instead. +PATCH_GO_TEST = """_sed_binary="sed" +if [ "$(uname)" == "Darwin" ]; then + _sed_binary="gsed" +fi +$_sed_binary -i "s/func {}/func _{}/g" {}/*.go +""" + +# Assemble go test patches, based on the currently defined version. +# See //dev/backcompat:test_release_version.bzl for the version definition. +PATCH_GO_TEST_CMDS = [ + PATCH_GO_TEST.format(test["prefix"], test["prefix"], test["path"], test["prefix"], test["reason"]) + for test in FLAKES[MINIMUM_UPGRADEABLE_VERSION] +] + +# Join all individual go test patches into a single shell snippet. +PATCH_ALL_GO_TESTS_CMD = "\n".join(PATCH_GO_TEST_CMDS) + +# Replaces all occurences of @com_github_sourcegraph_(scip|conc) by @back_compat_com_github_sourcegraph_(scip|conc). +PATCH_BUILD_FIXES_CMD = """_sed_binary="sed" +if [ "$(uname)" == "Darwin" ]; then + _sed_binary="gsed" +fi +find . -type f -name "*.bazel" -exec $_sed_binary -i 's|@com_github_sourcegraph_conc|@back_compat_com_github_sourcegraph_conc|g' {} + +find . -type f -name "*.bazel" -exec $_sed_binary -i 's|@com_github_sourcegraph_scip|@back_compat_com_github_sourcegraph_scip|g' {} + +""" + +def back_compat_defs(): + # github.com/sourcegraph/scip and github.com/sourcegraph/conc both rely on a few + # internal libraries from github.com/sourcegraph/sourcegraph/lib and their + # respective go_repository rules are annoted with build directives for Gazelle + # that fixes package resolution. + # + # When we're cloning the git repository of sourcegraph/sourcegraph on the release version + # we're testing against, those directives are not working as intended, as they appear to be + # evaluate target resolution in the global scope instead of @sourcegraph_back_compat, leading + # to compiling these two packages with the right targets, but linking them against the ones + # from our root workspace. + # + # So to work around that, we introduce two additional go_repository rules, which are the one that + # @sourcegraph_back_compat declares, but we rewrite the directives to resolve toward + # @sourcegraph_back_compat explicitly. The version/sum are exactly the same ones as defined + # by @sourcegraph_back_compat on the commit tagged by the release. + # + # And to make this work, we patch on the fly buildfiles in @sourcegraph_back_compat to reference + # the newly declared repos, by replacing all occurences of @com_github_sourcegraph_scip by + # @back_compat_com_github_sourcegraph_scip (and same thing for sourcegraph/conc). + go_repository( + name = "back_compat_com_github_sourcegraph_scip", + # This fixes the build for sourcegraph/scip which depends on sourcegraph/sourcegraph/lib but + # gazelle doesn't know how to resolve those packages from within sourcegraph/scip. + build_directives = [ + "gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/errors @sourcegraph_back_compat//lib/errors", + "gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol @sourcegraph_back_compat//lib/codeintel/lsif/protocol", + "gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader @sourcegraph_back_compat//lib/codeintel/lsif/protocol/reader", + "gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/writer @sourcegraph_back_compat//lib/codeintel/lsif/protocol/writer", + ], + build_file_proto_mode = "disable_global", + importpath = "github.com/sourcegraph/scip", + sum = "h1:fWPxLkDObzzKTGe9vb6wpzK0FYkwcfSxmxUBvAOc8aw=", # Need to be manually updated when bumping the back compat release target. + version = "v0.2.4-0.20221213205653-aa0e511dcfef", # Need to be manually updated when bumping the back compat release target. + ) + + # Same logic for this repository. + go_repository( + name = "back_compat_com_github_sourcegraph_conc", + build_directives = [ + "gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/errors @sourcegraph_back_compat//lib/errors", + ], + build_file_proto_mode = "disable_global", + importpath = "github.com/sourcegraph/conc", + sum = "h1:96VpOCAtXDCQ8Oycz0ftHqdPyMi8w12ltN4L2noYg7s=", # Need to be manually updated when bumping the back compat release target. + version = "v0.2.0", # Need to be manually updated when bumping the back compat release target. + ) + + + # Now that we have declared a replacement for the two problematic go packages that + # @sourcegraph_back_compat depends on, we can define the repository itself. Because it + # comes with its Bazel rules (logical, that's just the current repository but with a different + # commit), we can simply use git_repository to fetch it and apply patches on the fly to + # inject migrations and build fixes. + git_repository( + name = "sourcegraph_back_compat", + remote = "https://github.com/sourcegraph/sourcegraph.git", + patches = ["//dev/backcompat/patches:back_compat_migrations.patch"], + patch_args = ["-p1"], + commit = MINIMUM_UPGRADEABLE_VERSION_REF, + patch_cmds = [ + # webpack rules are complaining about a missing entry point, which is irrelevant as we're + # simply running go tests only. Therefore, we can simply drop the client folder. + # + # Because the target release at the time of writing this comment is 5.0.0 which was + # before we fully switched to Bazel, it's not exactly in a buildable state, and we're using + # a backported fix to make it buildable. That fix is merely about running `bazel configure` + # and dropping the client folder. + # + # "rm -Rf client", + PATCH_ALL_GO_TESTS_CMD, + PATCH_BUILD_FIXES_CMD, + # Seems to be affecting the root workspace somehow. + # TODO(JH) Look into bzlmod. + "rm .bazelversion", + ], + ) diff --git a/dev/backcompat/flakes.bzl b/dev/backcompat/flakes.bzl new file mode 100644 index 00000000000..86a2b680914 --- /dev/null +++ b/dev/backcompat/flakes.bzl @@ -0,0 +1,17 @@ +"""Defines flaky tests to disable when running tests from the release we're testing the new database schema against. +""" + +FLAKES = { + "5.0.0": [ + { + "path": "enterprise/cmd/frontend/internal/batches/resolvers", + "prefix": "TestRepositoryPermissions", + "reason": "Test was having incomplete data, fails now that constraints are in place" + }, + { + "path": "dev/sg/linters", + "prefix": "TestLibLogLinter", + "reason": "Test was having incomplete data, fails now that constraints are in place" + } + ] +} diff --git a/dev/backcompat/patches/BUILD.bazel b/dev/backcompat/patches/BUILD.bazel new file mode 100644 index 00000000000..c8e56553494 --- /dev/null +++ b/dev/backcompat/patches/BUILD.bazel @@ -0,0 +1,4 @@ +exports_files([ + # See https://sourcegraph.com/search?q=context:global+dev/backcompat/patches/back_compat_migrations.patch+repo:github.com/sourcegraph/sourcegraph+lang:Go&patternType=standard&sm=0&groupBy=repo + "back_compat_migrations.patch", # git diff ci/backcompat-v5.0.0 ..HEAD -- migrations/ > migrations/back_compat_migrations.patch +]) diff --git a/dev/backcompat/patches/back_compat_migrations.patch b/dev/backcompat/patches/back_compat_migrations.patch new file mode 100644 index 00000000000..ce3b24b9ab9 --- /dev/null +++ b/dev/backcompat/patches/back_compat_migrations.patch @@ -0,0 +1,3 @@ +diff --git a/failme b/failme +--- This patch to port new migrations onto old release needs to be generated to insert the back compat tests, see docs in dev backcompat ++++ Read the docs in dev/backcompat diff --git a/dev/backcompat/test_release_version.bzl b/dev/backcompat/test_release_version.bzl new file mode 100644 index 00000000000..5c15cd5d770 --- /dev/null +++ b/dev/backcompat/test_release_version.bzl @@ -0,0 +1,13 @@ +"""Defines the minimum ugradeable version of Sourcegraph. + +This designates the mininum version from which we guarantees the newest database +schema can run. + +See https://docs.sourcegraph.com/dev/background-information/sql/migrations +""" + +# Defines which version we target with the backward compatibility tests. +MINIMUM_UPGRADEABLE_VERSION = "5.0.0" + +# Defines a reproducible reference to clone Sourcegraph at to run those tests. +MINIMUM_UPGRADEABLE_VERSION_REF = "177663e4329d712f3493787410f71da60fe5dc7f" diff --git a/dev/ci/go-backcompat/BUILD.bazel b/dev/ci/go-backcompat/BUILD.bazel deleted file mode 100644 index c2f98e0175f..00000000000 --- a/dev/ci/go-backcompat/BUILD.bazel +++ /dev/null @@ -1,20 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") - -go_library( - name = "go-backcompat_lib", - srcs = ["reorganize.go"], - importpath = "github.com/sourcegraph/sourcegraph/dev/ci/go-backcompat", - visibility = ["//visibility:private"], - deps = [ - "//internal/database/migration/definition", - "//internal/database/migration/schemas", - "@com_github_keegancsmith_sqlf//:sqlf", - "@in_gopkg_yaml_v2//:yaml_v2", - ], -) - -go_binary( - name = "go-backcompat", - embed = [":go-backcompat_lib"], - visibility = ["//visibility:public"], -) diff --git a/dev/ci/go-backcompat/README.md b/dev/ci/go-backcompat/README.md deleted file mode 100644 index 99c0c875c25..00000000000 --- a/dev/ci/go-backcompat/README.md +++ /dev/null @@ -1,15 +0,0 @@ -The `flakefiles` directory contains _flakefiles_ that lists tests to disable when running Postgres backwards compatibility tests (see [go-backcompat/test.sh](../go-backcompat/test.sh)). - -Since we are running _historic_ tests, we are unable to change or fix them in the presence of flake or acceptable/spurious failures. In these cases, we can add the tests to an explicit lists of tests that we disable prior to invoking `go test`. The content of each flakefile looks similar to the following: - -```json -[ - { "path": "cmd/A/server", "prefix": "TestA", "reason": "Unused outside of Cloud." }, - { "path": "cmd/B/server", "prefix": "TestB", "reason": "Test was determiened to be flaky." }, - { "path": "cmd/C/server", "prefix": "TestC", "reason": "Dropped column presenting security issue." } -] -``` - -Each line indicates a _path_ and _prefix_ pair, where any test starting with the given prefix in a Go test file under the given path will be disabled (renamed so that it's invoked on the following `go test` invocations). This is limited to top-level tests defined as functions in a test package (and not sub-tests invoked by `t.Run(...)`. - -Each flakefile should have a name of the form `v3.{minor}.0.json`, where the version indicates the time at which tests should be disabled. Note that the most recent release will only ever be relevant day-to-day. diff --git a/dev/ci/go-backcompat/flakefiles/.gitkeep b/dev/ci/go-backcompat/flakefiles/.gitkeep deleted file mode 100644 index 8b137891791..00000000000 --- a/dev/ci/go-backcompat/flakefiles/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/dev/ci/go-backcompat/flakefiles/v3.35.0.json b/dev/ci/go-backcompat/flakefiles/v3.35.0.json deleted file mode 100644 index befd82655de..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.35.0.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "path": "enterprise/internal/insights", - "prefix": "Test", - "reason": "Code insights is deprecating TimescaleDB" - }, - { - "path": "internal/repos", - "prefix": "TestIntegration", - "reason": "TestIntegration/Syncer/MultipleServices failed with flake in https://buildkite.com/sourcegraph/sourcegraph/builds/125666#035ef196-3c58-4dc4-93d9-eabc97652d03." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.37.0.json b/dev/ci/go-backcompat/flakefiles/v3.37.0.json deleted file mode 100644 index 703a11b8611..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.37.0.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "path": "internal/database/migration/store", - "prefix": "TestIndexStatus", - "reason": "Failed with flake in https://buildkite.com/sourcegraph/sourcegraph/builds/133420." - }, - { - "path": "internal/database/connections/live", - "prefix": "TestMigrations", - "reason": "Breaking migration definition change (only affects self-validation of schemas, which does not affect backcompat at runtime) in https://github.com/sourcegraph/sourcegraph/pull/31782u." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.38.0.json b/dev/ci/go-backcompat/flakefiles/v3.38.0.json deleted file mode 100644 index ec2c983734c..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.38.0.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "path": "enterprise/internal/database", - "prefix": "TestCodeMonitorStoreLastSearched", - "reason": "Feature is experimental and not enabled for any customers" - }, - { - "path": "enterprise/internal/codemonitors", - "prefix": "TestCodeMonitorHook", - "reason": "Feature is experimental and not enabled for any customers" - }, - { - "path": "internal/database", - "prefix": "TestUsers_CheckAndDecrementInviteQuota", - "reason": "Test is written in a bad way (depends on default value definition, but does not affect backwards compatibility) in https://github.com/sourcegraph/sourcegraph/pull/33786." - }, - { - "path": "internal/database/migration/store", - "prefix": "TestIndexStatus", - "reason": "Flaky condition reported in https://github.com/sourcegraph/sourcegraph/issues/33837, fixed in https://github.com/sourcegraph/sourcegraph/pull/33843." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.39.0.json b/dev/ci/go-backcompat/flakefiles/v3.39.0.json deleted file mode 100644 index a885f391178..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.39.0.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "path": "cmd/gitserver/server", - "prefix": "TestCleanup_computeStats", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "cmd/gitserver/server", - "prefix": "TestCleanup_setRepoSizes", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/database", - "prefix": "TestIterateRepoGitserverStatus", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/database", - "prefix": "TestSetRepoSize", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/database", - "prefix": "TestListIndexableRepos", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.40.0.json b/dev/ci/go-backcompat/flakefiles/v3.40.0.json deleted file mode 100644 index bed031486e3..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.40.0.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "path": "cmd/gitserver/server", - "prefix": "TestCleanup_computeStats", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "cmd/gitserver/server", - "prefix": "TestCleanup_setRepoSizes", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/database", - "prefix": "TestIterateRepoGitserverStatus", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/database", - "prefix": "TestSetRepoSize", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/database", - "prefix": "TestListIndexableRepos", - "reason": "Database semantics changed: every created repo has a corresponding gitserver_repo entry right after being inserted in repo table (https://github.com/sourcegraph/sourcegraph/pull/35633)" - }, - { - "path": "internal/usagestats", - "prefix": "TestGetBatchChangesUsageStatistics", - "reason": "Flaky test, reflects disabling PR https://github.com/sourcegraph/sourcegraph/pull/36216 in the backcompat tests." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.41.0.json b/dev/ci/go-backcompat/flakefiles/v3.41.0.json deleted file mode 100644 index 5f688222d2a..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.41.0.json +++ /dev/null @@ -1,77 +0,0 @@ -[ - { - "path": "internal/codeintel/dependencies/internal/store", - "prefix": "TestLockfileDependencies", - "reason": "A 2-column unique index has been changed to 3 columns to keep existing 'on conflict upsert' behaviour. We can't easily keep that backwards compatible since we can't keep the 2 and 3-column index and since NULL != NULL the 3-column index won't produce conflicts when only 2/3 columns are inserted." - }, - { - "path": "internal/codeintel/dependencies/internal/store", - "prefix": "TestSelectRepoRevisionsToResolve", - "reason": "A 2-column unique index has been changed to 3 columns to keep existing 'on conflict upsert' behaviour. We can't easily keep that backwards compatible since we can't keep the 2 and 3-column index and since NULL != NULL the 3-column index won't produce conflicts when only 2/3 columns are inserted." - }, - { - "path": "internal/codeintel/dependencies/internal/store", - "prefix": "TestUpdateResolvedRevisions", - "reason": "A 2-column unique index has been changed to 3 columns to keep existing 'on conflict upsert' behaviour. We can't easily keep that backwards compatible since we can't keep the 2 and 3-column index and since NULL != NULL the 3-column index won't produce conflicts when only 2/3 columns are inserted." - }, - { - "path": "internal/codeintel/dependencies/internal/store", - "prefix": "TestLockfileDependents", - "reason": "A 2-column unique index has been changed to 3 columns to keep existing 'on conflict upsert' behaviour. We can't easily keep that backwards compatible since we can't keep the 2 and 3-column index and since NULL != NULL the 3-column index won't produce conflicts when only 2/3 columns are inserted." - }, - { - "path": "internal/database", - "prefix": "TestEventLogs_CodeIntelligenceSettingsPageViewCounts", - "reason": "Unclear why this is failing; disabling to unblock CI. Re-enabling tracked in https://github.com/sourcegraph/sourcegraph/issues/37623" - }, - { - "path": "internal/database", - "prefix": "TestScanFirstBitbucketProjectPermissionsJob", - "reason": "Used SELECT * in test, which is not backwards compatible. The actual code doesn't." - }, - { - "path": "internal/database", - "prefix": "TestBitbucketProjectPermissionsEnqueue", - "reason": "Used SELECT * in test, which is not backwards compatible. The actual code doesn't." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestBatchSpecWorkspaceResolver", - "reason": "Forgot to add userIDs to some records in tests, which fails now but is backwards compatible for app code." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestBatchSpecResolver_BatchSpecCreatedFromRaw", - "reason": "Forgot to add userIDs to some records in tests, which fails now but is backwards compatible for app code." - }, - { - "path": "enterprise/internal/batches/service", - "prefix": "TestService", - "reason": "Forgot to add userIDs to some records in tests, which fails now but is backwards compatible for app code." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestBatchSpecWorkspaceExecutionWorkerStore_MarkComplete", - "reason": "Forgot to add userIDs to some records in tests, which fails now but is backwards compatible for app code." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestBatchSpecWorkspaceExecutionWorkerStore_MarkFailed", - "reason": "Forgot to add userIDs to some records in tests, which fails now but is backwards compatible for app code." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestBatchSpecWorkspaceExecutionWorkerStore_MarkComplete_EmptyDiff", - "reason": "Forgot to add userIDs to some records in tests, which fails now but is backwards compatible for app code." - }, - { - "path": "internal/usagestats", - "prefix": "TestGetBatchChangesUsageStatistics", - "reason": "Fixed up DB constraints, now the test inserts invalid test data." - }, - { - "path": "dev/sg/internal/check", - "prefix": "RunnerInteractive", - "reason": "Flake was only fixed after 3.41, doesn't interact with databases anyway." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.42.0.json b/dev/ci/go-backcompat/flakefiles/v3.42.0.json deleted file mode 100644 index 2769e43813a..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.42.0.json +++ /dev/null @@ -1,52 +0,0 @@ -[ - { - "path": "internal/usagestats", - "prefix": "TestGetBatchChangesUsageStatistics", - "reason": "Fixed up DB constraints, now the test inserts invalid test data." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestPublishChangesets", - "reason": "New DB structure doesn't work with old test helper data." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestReenqueueChangesets", - "reason": "New DB structure doesn't work with old test helper data." - }, - { - "path": "enterprise/internal/batches/processor", - "prefix": "TestBulkProcessor", - "reason": "New DB structure doesn't work with old test helper data." - }, - { - "path": "enterprise/internal/batches/service", - "prefix": "TestService", - "reason": "New DB structure doesn't work with old test helper data." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestIntegration", - "reason": "New DB structure doesn't work with old test helper data." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestCancelQueuedBatchChangeChangesets", - "reason": "New DB structure doesn't work with old test helper data." - }, - { - "path": "lib/group", - "prefix": "ResultErrorGroup", - "reason": "A flaky test that was made unflaky after the release cut" - }, - { - "path": "internal/database", - "prefix": "TestDBTransactions", - "reason": "This test was fixed in 3d51294 but the fix not make it into 3.42.0. It causes the whole test suite to deadlock and that deadlocks shows up reliably in this test." - }, - { - "path": "internal/database/basestore", - "prefix": "TestConcurrentTransactions", - "reason": "Related test (see above) was fixed in 3d51294 but did not make it into 3.42.0. It causes the whole test suite to deadlock and that deadlocks shows up reliably in this test." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v3.43.0.json b/dev/ci/go-backcompat/flakefiles/v3.43.0.json deleted file mode 100644 index dbae14106db..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v3.43.0.json +++ /dev/null @@ -1,262 +0,0 @@ -[ - { - "path": "internal/database", - "prefix": "TestUsers_ValidUsernames", - "reason": "The username column constraint has been updated to allow underscores. The change is not auto-reversible." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/webhooks", - "prefix": "TestWebhooksIntegration", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/worker/internal/batches/workers", - "prefix": "TestBatchSpecWorkspaceCreatorProcess_Caching", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/worker/internal/batches/workers", - "prefix": "TestBatchSpecWorkspaceCreatorProcess_Importing", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/worker/internal/batches/workers", - "prefix": "TestBatchSpecWorkspaceCreatorProcess_NoDiff", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/worker/internal/batches/workers", - "prefix": "TestReconcilerWorkerView", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/worker/internal/batches/workers", - "prefix": "TestReconcilerWorkerView", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "internal/usagestats", - "prefix": "TestGetBatchChangesUsageStatistics", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestBatchSpecResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestBatchSpecResolver_BatchSpecCreatedFromRaw", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestBulkOperationConnectionResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestBulkOperationResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetApplyPreviewConnectionResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetApplyPreviewResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetApplyPreviewResolverWithPublicationStates", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetConnectionResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetCountsOverTimeIntegration", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetEventConnectionResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetSpecConnectionResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetSpecResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetResolver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestPermissionLevels", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestRepositoryPermissions", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestCreateBatchSpec", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestCreateChangesetSpec", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestApplyBatchChange", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestCreateEmptyBatchChange", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestUpsertEmptyBatchChange", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestCreateBatchChange", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestApplyOrCreateBatchSpecWithPublicationStates", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestApplyBatchChangeWithLicenseFail", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestCreateChangesetComments", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestReenqueueChangesets", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestMergeChangesets", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestCloseChangesets", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestPublishChangesets", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/processor", - "prefix": "TestBulkProcessor", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/reconciler", - "prefix": "TestExecutor_ExecutePlan", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/reconciler", - "prefix": "TestExecutor_ExecutePlan_PublishedChangesetDuplicateBranch", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/reconciler", - "prefix": "TestExecutor_ExecutePlan_AvoidLoadingChangesetSource", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/reconciler", - "prefix": "TestExecutor_UserCredentialsForGitserver", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/reconciler", - "prefix": "TestReconcilerProcess_IntegrationTest", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/service", - "prefix": "TestServiceApplyBatchChange", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/service", - "prefix": "TestServicePermissionLevels", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/service", - "prefix": "TestService", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestStore_ListBatchSpecRepoIDs", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestCancelQueuedBatchChangeChangesets", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestEnqueueChangesetsToClose", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestCleanDetachedChangesets", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestBatchSpecWorkspaceExecutionWorkerStore_MarkComplete", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestBatchSpecWorkspaceExecutionWorkerStore_MarkComplete_EmptyDiff", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestIntegration", - "reason": "Removed the `diff_stat_changed` column from changeset and changeset_specs table." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v4.0.0.json b/dev/ci/go-backcompat/flakefiles/v4.0.0.json deleted file mode 100644 index 4cd133aefaf..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v4.0.0.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "path": "internal/database", - "prefix": "TestUsers_ValidUsernames", - "reason": "The username column constraint has been updated to allow underscores. The change is not auto-reversible." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetApplyPreviewResolverWithPublicationStates", - "reason": "A constraint has been added to the published column to prevent string 'null' values. The test tries to set a 'null' string value on the row." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v4.1.0.json b/dev/ci/go-backcompat/flakefiles/v4.1.0.json deleted file mode 100644 index 46e038829e2..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v4.1.0.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "path": "internal/codeintel/policies/internal/store", - "prefix": "TestSelectPoliciesForRepositoryMembershipUpdate", - "reason": "The same policies are returned but in an unexpected order." - }, - { - "path": "internal/gitserver", - "prefix": "TestLFSSmudge", - "reason": "Git config seems to be borked after introduction of https://github.com/sourcegraph/sourcegraph/pull/43227" - }, - { - "path": "github.com/sourcegraph/sourcegraph/internal/repos", - "prefix": "EnqueueWebhookBuildJob", - "reason": "Flakes repeatedly in CI" - }, - { - "path": "internal/database", - "prefix": "TestWebhookCreate", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookDelete", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookUpdate", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookCount", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookList", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - - { - "path": "internal/database", - "prefix": "TestGetByID", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestGetByUUID", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestIntegration", - "reason": "Added a UNIQUE constraint on batch_specs.rand_id and changeset_specs.rand_id, some tests fail because we had some duplicate Rand ID creation in tests." - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v4.2.0.json b/dev/ci/go-backcompat/flakefiles/v4.2.0.json deleted file mode 100644 index 105ba97e24e..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v4.2.0.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "path": "cmd/frontend/webhooks", - "prefix": "TestWebhooksHandler", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookCount", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookList", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookCreate", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookDelete", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookUpdate", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestWebhookLogStore", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestGetByID", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "internal/database", - "prefix": "TestGetByUUID", - "reason": "New NOT NULL `name` column is added. The test is trying to add an entry without populating this column." - }, - { - "path": "enterprise/internal/batches/store", - "prefix": "TestIntegration", - "reason": "Added a UNIQUE constraint on batch_specs.rand_id and changeset_specs.rand_id, some tests fail because we had some duplicate Rand ID creation in tests." - }, - { - "path": "enterprise/internal/batches/syncer", - "prefix": "SyncerRun/Sync_due_but_reenqueued_when_namespace_deleted", - "reason": "Test expectation is too narrow and is broken by new logging code" - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v4.3.0.json b/dev/ci/go-backcompat/flakefiles/v4.3.0.json deleted file mode 100644 index ee197af1d6a..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v4.3.0.json +++ /dev/null @@ -1,82 +0,0 @@ -[ - { - "path": "enterprise/internal/batches/store", - "prefix": "TestIntegration", - "reason": "Added a UNIQUE constraint on batch_specs.rand_id and changeset_specs.rand_id, some tests fail because we had some duplicate Rand ID creation in tests." - }, - { - "path": "enterprise/cmd/frontend/internal/batches/webhooks", - "prefix": "TestWebhooksIntegration", - "reason": "Test was having incomplete data, fails now that constraints are in place" - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetApplyPreviewResolverWithPublicationStates", - "reason": "Test was having incomplete data, fails now that constraints are in place" - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestChangesetCountsOverTimeIntegration", - "reason": "Test was having incomplete data, fails now that constraints are in place" - }, - { - "path": "enterprise/cmd/frontend/internal/batches/resolvers", - "prefix": "TestRepositoryPermissions", - "reason": "Test was having incomplete data, fails now that constraints are in place" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestDatabaseExists", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestDatabaseHover", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestDatabaseDefinitions", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestDatabaseReferences", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestDatabaseMonikersByPosition", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestGetBulkMonikerLocations", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestGetPackageInformation", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestGetRanges", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "TestStencil", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/codeintel/uploads/internal/lsifstore", - "prefix": "TestWriteSCIPSymbols", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - }, - { - "path": "enterprise/internal/oobmigration/migrations/codeintel", - "prefix": "TestSCIPMigrator", - "reason": "Dropped symbol_name column on codeintel_scip_symbols" - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v4.4.0.json b/dev/ci/go-backcompat/flakefiles/v4.4.0.json deleted file mode 100644 index 6f5876afa03..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v4.4.0.json +++ /dev/null @@ -1,142 +0,0 @@ -[ - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByRoleIDAndPermissionID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByRoleID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByPermissionID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleList/basic_no_opts", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleList/with_pagination", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleList", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleCount", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleUpdate", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleUpdate/non-existent_role", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleUpdate/existing_role", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestUserRoleGetByRoleIDAndUserID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestUserRoleGetByUserID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestUserRoleCreate", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestUserRoleDelete", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestUserRoleDelete/existing_role", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestUserRoleGetByRoleID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionCreate", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleDelete", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleDelete/existing_role", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByRoleIDAndPermissionID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByRoleID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByPermissionID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionGetByRoleID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleGetByID", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRolePermissionDelete", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestRoleCreate", - "reason": "The column `readonly` has been renamed to `system`, pre 4.4." - }, - { - "path": "internal/database", - "prefix": "TestPermissionSyncJobs_CreateAndList", - "reason": "The column boolean column`high_priority` has been replaced by numeric column `priority`. Table not in use for 4.4." - }, - { - "path": "internal/adminanalytics", - "prefix": "TestMonthlyActiveUsersLast3Month", - "reason": "Month subtraction produces inconsistent results, see https://github.com/sourcegraph/sourcegraph/issues/47152" - } -] diff --git a/dev/ci/go-backcompat/flakefiles/v4.5.0.json b/dev/ci/go-backcompat/flakefiles/v4.5.0.json deleted file mode 100644 index 16cd0fd3f9e..00000000000 --- a/dev/ci/go-backcompat/flakefiles/v4.5.0.json +++ /dev/null @@ -1,52 +0,0 @@ -[ - { - "path": "internal/codeintel/dependencies/internal/store", - "prefix": "TestListPackageRepoRefs", - "reason": "References a column directly in the test that is being dropped post 4.5. No application code references the column" - }, - { - "path": "enterprise/internal/codeintel/codenav/internal/lsifstore", - "prefix": "Test", - "reason": "Removing LSIF tables that no longer contain data." - }, - { - "path": "enterprise/internal/codeintel/uploads/internal/lsifstore", - "prefix": "Test", - "reason": "Removing LSIF tables that no longer contain data." - }, - { - "path": "enterprise/internal/oobmigration/migrations/codeintel", - "prefix": "Test", - "reason": "Removing LSIF tables that no longer contain data." - }, - { - "path": "enterprise/internal/codeintel/ranking/internal/store", - "prefix": "TestDocumentRanks", - "reason": "Changed format of table in a feature that wasn't enabled." - }, - { - "path": "enterprise/internal/codeintel/ranking/internal/store", - "prefix": "TestBulkSetAndMergeDocumentRanks", - "reason": "Changed format of table in a feature that wasn't enabled." - }, - { - "path": "enterprise/internal/codeintel/ranking/internal/store", - "prefix": "TestLastUpdatedAt", - "reason": "Changed format of table in a feature that wasn't enabled." - }, - { - "path": "enterprise/internal/codeintel/ranking/internal/store", - "prefix": "TestUpdatedAfter", - "reason": "Changed format of table in a feature that wasn't enabled." - }, - { - "path": "internal/database", - "prefix": "TestRepos_List_LastChanged", - "reason": "Changed format of table in a feature that wasn't enabled." - }, - { - "path": "enterprise/cmd/frontend/internal/rbac/resolvers", - "prefix": "TestCreateRole", - "reason": "Changed the column type for role names from `text` to `citext` and introduced a new unique index for the column." - } -] diff --git a/dev/ci/go-backcompat/reorganize.go b/dev/ci/go-backcompat/reorganize.go deleted file mode 100644 index c520d7e4cea..00000000000 --- a/dev/ci/go-backcompat/reorganize.go +++ /dev/null @@ -1,62 +0,0 @@ -package main - -import ( - "os" - "path/filepath" - "strconv" - - "github.com/keegancsmith/sqlf" - "gopkg.in/yaml.v2" - - "github.com/sourcegraph/sourcegraph/internal/database/migration/definition" - "github.com/sourcegraph/sourcegraph/internal/database/migration/schemas" -) - -func main() { - if len(os.Args) != 2 { - panic("expected temp directory as argument") - } - tempDirectory := os.Args[1] - - contents := map[string]string{} - for _, schema := range schemas.Schemas { - for _, def := range schema.Definitions.All() { - metadata, err := renderMetadata(def) - if err != nil { - panic(err.Error()) - } - - migrationDirectory := filepath.Join(tempDirectory, schema.Name, strconv.Itoa(def.ID)) - - contents[filepath.Join(migrationDirectory, "metadata.yaml")] = string(metadata) - contents[filepath.Join(migrationDirectory, "up.sql")] = def.UpQuery.Query(sqlf.PostgresBindVar) - contents[filepath.Join(migrationDirectory, "down.sql")] = def.DownQuery.Query(sqlf.PostgresBindVar) - } - } - - for path, contents := range contents { - if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { - panic(err.Error()) - } - - if err := os.WriteFile(path, []byte(contents), os.FileMode(0644)); err != nil { - panic(err.Error()) - } - } -} - -func renderMetadata(definition definition.Definition) ([]byte, error) { - return yaml.Marshal(struct { - Name string `yaml:"name"` - Parents []int `yaml:"parents"` - CreateIndexConcurrently bool `yaml:"createIndexConcurrently"` - Privileged bool `yaml:"privileged"` - NonIdempotent bool `yaml:"nonIdempotent"` - }{ - Name: definition.Name, - Parents: definition.Parents, - CreateIndexConcurrently: definition.IsCreateIndexConcurrently, - Privileged: definition.Privileged, - NonIdempotent: definition.NonIdempotent, - }) -} diff --git a/dev/ci/go-backcompat/test.sh b/dev/ci/go-backcompat/test.sh deleted file mode 100755 index d37c7e97cfd..00000000000 --- a/dev/ci/go-backcompat/test.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env bash - -# This script runs the go-build.sh in a clone of the previous minor release as part -# of the continuous backwards compatibility regression tests. - -cd "$(dirname "${BASH_SOURCE[0]}")/../../../" -set -eu - -MIGRATION_STAGING=$(mktemp -d -t sgdockerbuild_XXXXXXX) -cleanup() { - rm -rf "$MIGRATION_STAGING" -} -trap cleanup EXIT - -# `disable_test ${path} ${prefix}` rewrites `func ${prefix}` to `func _${prefix}` -# in the given Go test file. This will return 1 if there was a matching test and -# return 0 otherwise. -function disable_test() { - sed -i_bak "s/func ${2}/func _${2}/g" "${1}" - - local ret=1 - if diff "${1}" "${1}_bak" >/dev/null; then - ret=0 # no diff - fi - - rm "${1}_bak" - return ${ret} -} - -# `disable_test_file ${path} ${prefix}` rewrites `func ${prefix}` to `func _${prefix}` -# in the given Go test file. If there is no matching test, an unknown test message is -# displayed and the script is halted with exit code 1. -function disable_test_file() { - if disable_test "${1}" "${2}"; then - echo "Unknown test in ${1}: ${2}" - exit 1 - fi -} - -# `disable_test_dir ${path} ${prefix}` rewrites `func ${prefix}` to `func _${prefix}` -# in all Go test files under the given path. -function disable_test_dir() { - local num_changed=0 - - while read -r path; do - if ! disable_test "${path}" "${2}"; then - num_changed=$((num_changed + 1)) - fi - done < <(find "${1}" -name '*_test.go' -type f) - - if [ ${num_changed} -eq 0 ]; then - echo "Unknown test in ${1}: ${2}" - fi -} - -# `disable_test_path ${path} ${prefix}` -function disable_test_path() { - echo "Disabling test '${2}*' in ${1}" - - if [ -d "${1}" ]; then - disable_test_dir "${1}" "${2}" - elif [ -f "${1}" ]; then - disable_test_file "${1}" "${2}" - fi -} - -current_head=$(git rev-parse HEAD) -latest_minor_release_tag="v${MINIMUM_UPGRADEABLE_VERSION}" -flakefile="./dev/ci/go-backcompat/flakefiles/${latest_minor_release_tag}.json" - -# Early exit -if git diff --quiet "${latest_minor_release_tag}".."${current_head}" migrations; then - echo "--- No schema changes" - echo "No schema changes since last minor release" - exit 0 -fi - -echo "--- Running backwards compatibility tests" -echo "current_head = ${current_head}" -echo "latest_minor_release_tag = ${latest_minor_release_tag}" -echo "" -echo "Running Go tests to test database schema backwards compatibility:" -echo "- database schemas are defined at HEAD / ${current_head}, and" -echo "- unit tests are defined at the last minor release ${latest_minor_release_tag}." -echo "" -echo "New failures of these tests indicate that new changes to the" -echo "database schema do not allow for continued proper operation of" -echo "Sourcegraph instances deployed at the previous release." -echo "" - -PROTECTED_FILES=( - ./dev/ci/go-test.sh - ./dev/ci/go-backcompat - ./dev/ci/asdf-install.sh - ./internal/database/migration/definition/read.go -) - -# Rewrite the current migrations into a temporary folder that we can force -# apply over old code. -go run ./dev/ci/go-backcompat/reorganize.go "${MIGRATION_STAGING}" - -# Check out the previous code then immediately restore whatever -# the current version of the protected files are. -git checkout "${latest_minor_release_tag}" -git checkout "${current_head}" -- "${PROTECTED_FILES[@]}" - -# Remove the languages submodules, because they mess these tests up -rm -rf ./docker-images/syntax-highlighter/crates/sg-syntax/languages/ - -for schema in frontend codeintel codeinsights; do - # Force apply newer schema definitions - rm -rf "./migrations/${schema}" - mv "${MIGRATION_STAGING}/${schema}" "./migrations/${schema}" -done - -# If migration files have been renamed or deleted between these commits -# (which historically we've done in response to reverted migrations), we -# might end up with a combination of files from both commits that ruin -# some of the assumptions we make (unique prefix ID being one major one). -# We delete this directory first prior to the checkout so that we don't -# have any current state in the migrations directory to mess us up in this -# way. - -if [ -f "${flakefile}" ]; then - echo "" - echo "Disabling tests listed in flakefile ${flakefile}" - - pairs=$(jq -r '.[] | "\(.path):\(.prefix)"' <"${flakefile}") - for pair in $pairs; do - IFS=' ' read -ra parts <<<"${pair/:/ }" - disable_test_path "${parts[0]}" "${parts[1]}" - done -fi - -# Re-run asdf to ensure we have the correct set of utilities to -# run the currently checked out version of the Go unit tests. -echo "--- asdf install checked out tools" -./dev/ci/asdf-install.sh -go version - -echo "--- run tests" -if ! ./dev/ci/go-test.sh "$@"; then - annotation=$( - cat < dev/backcompat/patches/back_compat_migrations.patch"), + } + + bazelRawCmd := bazelRawCmd(fmt.Sprintf("test %s", strings.Join(targets, " "))) + cmds = append( + cmds, + bk.RawCmd(bazelRawCmd), + ) + + return func(pipeline *bk.Pipeline) { + pipeline.AddStep(":bazel: BackCompat Tests", + cmds..., + ) + } +} + func bazelTestWithDepends(optional bool, dependsOn string, targets ...string) func(*bk.Pipeline) { cmds := []bk.StepOpt{ bk.Agent("queue", "bazel"), diff --git a/enterprise/dev/ci/internal/ci/operations.go b/enterprise/dev/ci/internal/ci/operations.go index f167d706ac3..a47f61a4bf8 100644 --- a/enterprise/dev/ci/internal/ci/operations.go +++ b/enterprise/dev/ci/internal/ci/operations.go @@ -115,15 +115,6 @@ func CoreTestOperations(diff changed.Diff, opts CoreTestOperationsOptions) *oper addGoBuild)) } - if diff.Has(changed.DatabaseSchema) { - // If there are schema changes, ensure the tests of the last minor release continue - // to succeed when the new version of the schema is applied. This ensures that the - // schema can be rolled forward pre-upgrade without negatively affecting the running - // instance (which was working fine prior to the upgrade). - ops.Merge(operations.NewNamedSet("DB backcompat tests", - addGoTestsBackcompat(opts.MinimumUpgradeableVersion))) - } - // CI script testing if diff.Has(changed.CIScripts) { ops.Merge(operations.NewNamedSet("CI script tests", addCIScriptsTests)) @@ -490,21 +481,6 @@ func addGoTests(pipeline *bk.Pipeline) { }) } -// Adds the Go backcompat test step. -func addGoTestsBackcompat(minimumUpgradeableVersion string) func(pipeline *bk.Pipeline) { - return func(pipeline *bk.Pipeline) { - buildGoTests(func(description, testSuffix string, additionalOpts ...bk.StepOpt) { - pipeline.AddStep( - fmt.Sprintf(":go::postgres: Backcompat test (%s)", description), - bk.Env("MINIMUM_UPGRADEABLE_VERSION", minimumUpgradeableVersion), - bk.AnnotatedCmd("./dev/ci/go-backcompat/test.sh "+testSuffix, bk.AnnotatedCmdOpts{ - Annotations: &bk.AnnotationOpts{}, - }), - ) - }) - } -} - // buildGoTests invokes the given function once for each subset of tests that should // be run as part of complete coverage. The description will be the specific test path // broken out to be run independently (or "all"), and the testSuffix will be the string