Skip to content

Commit 362d73f

Browse files
thepaulStorj Robot
authored andcommitted
satellite/audit: add tests for concurrent audits
This commit introduces tests that perform multiple concurrent audits against the same storage node, to make sure that doing so does not create incorrect outcomes. Refs: #5495 Change-Id: Iaae49e042306bfa59bdf04c1a1540667488e51e5
1 parent 4cb825a commit 362d73f

File tree

2 files changed

+392
-4
lines changed

2 files changed

+392
-4
lines changed

private/testblobs/bad.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ import (
1515
"storj.io/storj/storagenode"
1616
)
1717

18+
// ErrorBlobs is the interface of storage.Blobs with the SetError method added.
19+
// This allows the BadDB{}.Blobs member to be replaced with something that has
20+
// specific behavior changes.
21+
type ErrorBlobs interface {
22+
storage.Blobs
23+
SetError(err error)
24+
}
25+
1826
// BadDB implements bad storage node DB.
1927
type BadDB struct {
2028
storagenode.DB
21-
blobs *BadBlobs
29+
Blobs ErrorBlobs
2230
log *zap.Logger
2331
}
2432

@@ -27,19 +35,19 @@ type BadDB struct {
2735
func NewBadDB(log *zap.Logger, db storagenode.DB) *BadDB {
2836
return &BadDB{
2937
DB: db,
30-
blobs: newBadBlobs(log, db.Pieces()),
38+
Blobs: newBadBlobs(log, db.Pieces()),
3139
log: log,
3240
}
3341
}
3442

3543
// Pieces returns the blob store.
3644
func (bad *BadDB) Pieces() storage.Blobs {
37-
return bad.blobs
45+
return bad.Blobs
3846
}
3947

4048
// SetError sets an error to be returned for all piece operations.
4149
func (bad *BadDB) SetError(err error) {
42-
bad.blobs.SetError(err)
50+
bad.Blobs.SetError(err)
4351
}
4452

4553
// BadBlobs implements a bad blob store.

0 commit comments

Comments
 (0)