Skip to content

Commit b11206c

Browse files
committed
kvserver: use StateEngine in client_replica_gc_test.go
The test creates a file in the sideloaded entries directory, which is placed in the StateEngine. Epic: none Release note: none
1 parent abaee6b commit b11206c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

pkg/kv/kvserver/client_replica_gc_test.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ func TestReplicaGCQueueDropReplicaDirect(t *testing.T) {
9595
repl1 := store.LookupReplica(roachpb.RKey(k))
9696
require.NotNil(t, repl1)
9797

98-
eng := store.TODOEngine()
99-
10098
// Put some bogus sideloaded data on the replica which we're about to
10199
// remove. Then, at the end of the test, check that that sideloaded
102100
// storage is now empty (in other words, GC'ing the Replica took care of
@@ -105,15 +103,10 @@ func TestReplicaGCQueueDropReplicaDirect(t *testing.T) {
105103
dir := repl1.SideloadedRaftMuLocked().Dir()
106104
repl1.RaftUnlock()
107105

108-
if dir == "" {
109-
t.Fatal("no sideloaded directory")
110-
}
111-
if err := eng.Env().MkdirAll(dir, os.ModePerm); err != nil {
112-
t.Fatal(err)
113-
}
114-
if err := fs.WriteFile(eng.Env(), filepath.Join(dir, "i1000000.t100000"), []byte("foo"), fs.UnspecifiedWriteCategory); err != nil {
115-
t.Fatal(err)
116-
}
106+
require.NotEmpty(t, dir, "no sideloaded directory")
107+
eng := store.StateEngine()
108+
require.NoError(t, eng.Env().MkdirAll(dir, os.ModePerm))
109+
require.NoError(t, fs.WriteFile(eng.Env(), filepath.Join(dir, "i1000000.t100000"), []byte("foo"), fs.UnspecifiedWriteCategory))
117110

118111
defer func() {
119112
if !t.Failed() {

0 commit comments

Comments
 (0)