Skip to content

Commit

Permalink
kvserver: remove multiTestContext
Browse files Browse the repository at this point in the history
Closes cockroachdb#8299

With all the tests converted to use TestCluster/TestServer,
we can finally remove multiTestContext and all of the dependent
code.

Release note: None
  • Loading branch information
lunevalex committed Feb 3, 2021
1 parent 234d1c1 commit dfd9c60
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 1,329 deletions.
4 changes: 1 addition & 3 deletions pkg/kv/kvserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,10 @@ go_test(
"//pkg/config",
"//pkg/config/zonepb",
"//pkg/gossip",
"//pkg/gossip/resolver",
"//pkg/keys",
"//pkg/kv",
"//pkg/kv/kvclient",
"//pkg/kv/kvclient/kvcoord",
"//pkg/kv/kvclient/rangecache",
"//pkg/kv/kvserver/abortspan",
"//pkg/kv/kvserver/apply",
"//pkg/kv/kvserver/batcheval",
Expand Down Expand Up @@ -367,7 +365,6 @@ go_test(
"//pkg/util/timeutil",
"//pkg/util/tracing",
"//pkg/util/uuid",
"@com_github_cenkalti_backoff//:backoff",
"@com_github_cockroachdb_circuitbreaker//:circuitbreaker",
"@com_github_cockroachdb_datadriven//:datadriven",
"@com_github_cockroachdb_errors//:errors",
Expand All @@ -381,6 +378,7 @@ go_test(
"@com_github_kr_pretty//:pretty",
"@com_github_lib_pq//:pq",
"@com_github_olekukonko_tablewriter//:tablewriter",
"@com_github_pkg_errors//:errors",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@io_etcd_go_etcd_raft_v3//:raft",
Expand Down
30 changes: 0 additions & 30 deletions pkg/kv/kvserver/client_raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1763,36 +1763,6 @@ func TestStoreRangeUpReplicate(t *testing.T) {
}
}

// TestUnreplicateFirstRange verifies that multiTestContext still functions in
// the case where the first range (which contains range metadata) is
// unreplicated from the first store. This situation can arise occasionally in
// tests, as can a similar situation where the first store is no longer the lease holder of
// the first range; this verifies that those tests will not be affected.
// TODO(lunevalex): Remove this test when removing MTC, no need to convert it
func TestUnreplicateFirstRange(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

cfg := kvserver.TestStoreConfig(nil)
cfg.TestingKnobs.DisableReplicateQueue = true
mtc := &multiTestContext{storeConfig: &cfg}
defer mtc.Stop()
mtc.Start(t, 3)

const rangeID = roachpb.RangeID(1)
// Replicate the range to store 1.
mtc.replicateRange(rangeID, 1)
// Move the lease away from store 0 before removing its replica.
mtc.transferLease(context.Background(), rangeID, 0, 1)
// Unreplicate the from from store 0.
mtc.unreplicateRange(rangeID, 0)
require.NoError(t, mtc.waitForUnreplicated(rangeID, 0))
// Replicate the range to store 2. The first range is no longer available on
// store 1, and this command will fail if that situation is not properly
// supported.
mtc.replicateRange(rangeID, 2)
}

// TestChangeReplicasDescriptorInvariant tests that a replica change aborts if
// another change has been made to the RangeDescriptor since it was initiated.
func TestChangeReplicasDescriptorInvariant(t *testing.T) {
Expand Down
Loading

0 comments on commit dfd9c60

Please sign in to comment.