lib/mergeset: detect whether we are in test by executable suffix

This commit is contained in:
Aliaksandr Valialkin 2019-09-22 23:11:57 +03:00
parent d2ed8cb0b2
commit 3304dc1e85
2 changed files with 4 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package mergeset
import (
"fmt"
"os"
"sort"
"strings"
"sync"
@ -146,7 +147,9 @@ func (ib *inmemoryBlock) MarshalUnsortedData(sb *storageBlock, firstItemDst, com
return ib.marshalData(sb, firstItemDst, commonPrefixDst, compressLevel)
}
var isInTest bool
var isInTest = func() bool {
return strings.HasSuffix(os.Args[0], ".test")
}()
// MarshalUnsortedData marshals sorted items from ib to sb.
//

View file

@ -11,7 +11,6 @@ import (
)
func TestMain(m *testing.M) {
isInTest = true
n := m.Run()
os.Exit(n)
}