mirror of https://github.com/restic/restic.git
check: Fix flaky TestCheckerModifiedData
The test had a 4% chance of not modified the data read from the repository, in which case the test would fail. Change the data manipulation to just modified each read operation.
This commit is contained in:
parent
8d971172c4
commit
c0627dc80d
|
@ -331,10 +331,6 @@ func (erd errorReadCloser) Read(p []byte) (int, error) {
|
||||||
|
|
||||||
// induceError flips a bit in the slice.
|
// induceError flips a bit in the slice.
|
||||||
func induceError(data []byte) {
|
func induceError(data []byte) {
|
||||||
if rand.Float32() < 0.2 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
pos := rand.Intn(len(data))
|
pos := rand.Intn(len(data))
|
||||||
data[pos] ^= 1
|
data[pos] ^= 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue