feat: Skip encryption, signatures and compression in short tests mode

This commit is contained in:
Felicitas Pojtinger
2022-01-09 02:12:36 +01:00
parent 4738cb52f6
commit 96aa71a361

View File

@@ -86,6 +86,38 @@ type cryptoConfig struct {
}
func TestMain(m *testing.M) {
flag.Parse() // So that `testing.Short` can be called, see https://go-review.googlesource.com/c/go/+/7604/
if testing.Short() {
for _, writeCacheType := range config.KnownWriteCacheTypes {
for _, fileSystemCacheType := range config.KnownFileSystemCacheTypes {
for _, fileSystemCacheDuration := range fileSystemCacheDurations {
for _, recordSize := range recordSizes {
stfsConfigs = append(stfsConfigs, stfsConfig{
recordSize,
readOnly,
config.NoneKey,
nil,
nil,
config.NoneKey,
nil,
nil,
config.NoneKey,
config.CompressionLevelFastestKey,
writeCacheType,
fileSystemCacheType,
fileSystemCacheDuration,
})
}
}
}
}
} else {
signatures := []cryptoConfig{}
encryptions := []cryptoConfig{}
@@ -218,30 +250,6 @@ func TestMain(m *testing.M) {
wg.Wait()
flag.Parse() // So that `testing.Short` can be called, see https://go-review.googlesource.com/c/go/+/7604/
if testing.Short() {
stfsConfigs = append(stfsConfigs, stfsConfig{
20,
readOnly,
config.NoneKey,
nil,
nil,
config.NoneKey,
nil,
nil,
config.NoneKey,
config.CompressionLevelFastestKey,
config.WriteCacheTypeMemory,
config.FileSystemCacheTypeMemory,
time.Hour,
})
} else {
for _, signature := range signatures {
for _, encryption := range encryptions {
for _, compression := range config.KnownCompressionFormats {
@@ -620,19 +628,6 @@ func TestSTFS_Name(t *testing.T) {
config.FileSystemNameSTFS,
},
}
if testing.Short() {
tests = []struct {
name string
f afero.Fs
want string
}{
{
"Returns correct filesystem name",
fss[1].fs, // This is the first STFS config, [0] is the BasePathFs
"CacheOnReadFs",
},
}
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {