[bazel] Tag flaky emulator tests as "exclusive" to force sequential execution.

The affected tests are only flaky when running under Bazel locally (i.e. not on RBE) because they run in parallel and they share the same set of emulator instances, which causes the tests to interfere with each other.

These flakes do not occur under RBE because each test target gets its own set of emulator instances. These flakes do not occur when running tests with "go test" either, because test execution is sequential.

Bug: skia:11111
Change-Id: I43e5fc6ad61274a9a32943e80d19d3d842a050b5
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/373761
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
diff --git a/autoroll/go/autoroll-google3/BUILD.bazel b/autoroll/go/autoroll-google3/BUILD.bazel
index 9a81b50..c6dea64 100644
--- a/autoroll/go/autoroll-google3/BUILD.bazel
+++ b/autoroll/go/autoroll-google3/BUILD.bazel
@@ -47,6 +47,15 @@
     name = "autoroll-google3_test",
     srcs = ["google3_test.go"],
     embed = [":autoroll-google3_lib"],
+    tags = [
+        # Ensure that no other tests are running at the same time.
+        #
+        # This prevents "too much contention on these datastore entities" errors due to concurrent
+        # Datastore queries from multiple tests running in parallel.
+        #
+        # Reference: https://docs.bazel.build/versions/master/test-encyclopedia.html#tag-conventions
+        "exclusive",
+    ],
     deps = [
         "//autoroll/go/config",
         "//autoroll/go/recent_rolls",
diff --git a/autoroll/go/codereview/BUILD.bazel b/autoroll/go/codereview/BUILD.bazel
index 828a1df..a931165 100644
--- a/autoroll/go/codereview/BUILD.bazel
+++ b/autoroll/go/codereview/BUILD.bazel
@@ -29,6 +29,15 @@
     name = "codereview_test",
     srcs = ["roll_test.go"],
     embed = [":codereview"],
+    tags = [
+        # Ensure that no other tests are running at the same time.
+        #
+        # This prevents "too much contention on these datastore entities" errors due to concurrent
+        # Datastore queries from multiple tests running in parallel.
+        #
+        # Reference: https://docs.bazel.build/versions/master/test-encyclopedia.html#tag-conventions
+        "exclusive",
+    ],
     deps = [
         "//autoroll/go/config",
         "//autoroll/go/recent_rolls",
diff --git a/perf/go/dfbuilder/BUILD.bazel b/perf/go/dfbuilder/BUILD.bazel
index d6651f9..8e6514f 100644
--- a/perf/go/dfbuilder/BUILD.bazel
+++ b/perf/go/dfbuilder/BUILD.bazel
@@ -30,6 +30,15 @@
     srcs = ["dfbuilder_test.go"],
     data = ["//perf/migrations:cockroachdb"],
     embed = [":dfbuilder"],
+    tags = [
+        # Ensure that no other tests are running at the same time.
+        #
+        # This prevents 'pq: relation "schema_lock" already exists' errors due to concurrent
+        # CockroachDB queries from multiple tests running in parallel.
+        #
+        # Reference: https://docs.bazel.build/versions/master/test-encyclopedia.html#tag-conventions
+        "exclusive",
+    ],
     deps = [
         "//go/paramtools",
         "//go/query",
diff --git a/perf/go/dfiter/BUILD.bazel b/perf/go/dfiter/BUILD.bazel
index 9467455..135accd 100644
--- a/perf/go/dfiter/BUILD.bazel
+++ b/perf/go/dfiter/BUILD.bazel
@@ -23,6 +23,15 @@
     srcs = ["dfiter_test.go"],
     data = ["//perf/migrations:cockroachdb"],
     embed = [":dfiter"],
+    tags = [
+        # Ensure that no other tests are running at the same time.
+        #
+        # This prevents 'pq: relation "schema_lock" already exists' errors due to concurrent
+        # CockroachDB queries from multiple tests running in parallel.
+        #
+        # Reference: https://docs.bazel.build/versions/master/test-encyclopedia.html#tag-conventions
+        "exclusive",
+    ],
     deps = [
         "//go/paramtools",
         "//go/query",
diff --git a/perf/go/git/BUILD.bazel b/perf/go/git/BUILD.bazel
index 0822790..f32382c 100644
--- a/perf/go/git/BUILD.bazel
+++ b/perf/go/git/BUILD.bazel
@@ -28,6 +28,15 @@
     srcs = ["git_test.go"],
     data = ["//perf/migrations:cockroachdb"],
     embed = [":git"],
+    tags = [
+        # Ensure that no other tests are running at the same time.
+        #
+        # This prevents 'pq: relation "schema_lock" already exists' errors due to concurrent
+        # CockroachDB queries from multiple tests running in parallel.
+        #
+        # Reference: https://docs.bazel.build/versions/master/test-encyclopedia.html#tag-conventions
+        "exclusive",
+    ],
     deps = [
         "//go/git/testutils",
         "//go/testutils/unittest",
diff --git a/perf/go/trybot/results/dfloader/BUILD.bazel b/perf/go/trybot/results/dfloader/BUILD.bazel
index 408c313..1f4a6ac 100644
--- a/perf/go/trybot/results/dfloader/BUILD.bazel
+++ b/perf/go/trybot/results/dfloader/BUILD.bazel
@@ -27,6 +27,15 @@
     srcs = ["dfloader_test.go"],
     data = ["//perf/migrations:cockroachdb"],
     embed = [":dfloader"],
+    tags = [
+        # Ensure that no other tests are running at the same time.
+        #
+        # This prevents 'pq: relation "schema_lock" already exists' errors due to concurrent
+        # CockroachDB queries from multiple tests running in parallel.
+        #
+        # Reference: https://docs.bazel.build/versions/master/test-encyclopedia.html#tag-conventions
+        "exclusive",
+    ],
     deps = [
         "//go/paramtools",
         "//go/testutils/unittest",