Skip to content

Commit

Permalink
asim: extract assertions into its own package
Browse files Browse the repository at this point in the history
Previously, simulation assertions resided within the tests package.

Another PR(cockroachdb#109316) is introducing assertion registration which enables
scheduled assertion checks to run as delayed events. Since these assertion
events require the assertion structs to conduct assertion checks, the event
package would have to depend on the test package. However, the test package
would also have to depend on the event package’s exported struct to initialize
structures for event generation, creating a circular dependency.

To address this issue, this patch moves the assertion component out of the test
package to its own package.

Note that this commit does not change any existing behavior, and the main
purpose is to make future commits cleaner.

See also: cockroachdb#109316
Part of: cockroachdb#106192
Release note: none
  • Loading branch information
wenyihu6 committed Aug 29, 2023
1 parent 3202e06 commit cdb2833
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 154 deletions.
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ GO_TARGETS = [
"//pkg/kv/kvserver/allocator:allocator",
"//pkg/kv/kvserver/apply:apply",
"//pkg/kv/kvserver/apply:apply_test",
"//pkg/kv/kvserver/asim/assertion:assertion",
"//pkg/kv/kvserver/asim/config:config",
"//pkg/kv/kvserver/asim/event:event",
"//pkg/kv/kvserver/asim/gen:gen",
Expand Down
16 changes: 16 additions & 0 deletions pkg/kv/kvserver/asim/assertion/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "assertion",
srcs = ["assert.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/asim/assertion",
visibility = ["//visibility:public"],
deps = [
"//pkg/kv/kvserver/asim/history",
"//pkg/kv/kvserver/asim/metrics",
"//pkg/roachpb",
"//pkg/spanconfig/spanconfigtestutils",
"//pkg/util/log",
"@com_github_montanaflynn_stats//:stats",
],
)
Loading

0 comments on commit cdb2833

Please sign in to comment.