mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
clean up tests
This commit is contained in:
parent
6386a3174b
commit
693d6c0f1b
|
@ -37,6 +37,8 @@ func TestEncodingDecoding(t *testing.T) {
|
|||
t.Logf("writeSortedEcxFiles: %v", err)
|
||||
}
|
||||
|
||||
removeGeneratedFiles(baseFileName)
|
||||
|
||||
}
|
||||
|
||||
func generateEcFiles(baseFileName string, bufferSize int, largeBlockSize int64, smallBlockSize int64) error {
|
||||
|
@ -251,7 +253,7 @@ func readFromOtherEcFiles(ecFiles []*os.File, ecFileIndex int, ecFileOffset int6
|
|||
|
||||
bufs := make([][]byte, DataShardsCount+ParityShardsCount)
|
||||
for i := 0; i < DataShardsCount; {
|
||||
n := int(rand.Int31n(DataShardsCount+ParityShardsCount))
|
||||
n := int(rand.Int31n(DataShardsCount + ParityShardsCount))
|
||||
if n == ecFileIndex || bufs[n] != nil {
|
||||
continue
|
||||
}
|
||||
|
@ -281,6 +283,14 @@ func readFromFile(file *os.File, data []byte, ecFileOffset int64) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func removeGeneratedFiles(baseFileName string) {
|
||||
for i := 0; i < DataShardsCount+ParityShardsCount; i++ {
|
||||
fname := fmt.Sprintf("%s.ec%02d", baseFileName, i+1)
|
||||
os.Remove(fname)
|
||||
}
|
||||
os.Remove(baseFileName+".ecx")
|
||||
}
|
||||
|
||||
func TestLocateData(t *testing.T) {
|
||||
intervals := locateData(largeBlockSize, smallBlockSize, DataShardsCount*largeBlockSize+1, DataShardsCount*largeBlockSize, 1)
|
||||
if len(intervals) != 1 {
|
||||
|
|
Loading…
Reference in a new issue