feat(tests): add Parallelization where possible (#1823)

* feat(tests): add Parallelization where possible
This commit is contained in:
Kyle Sanderson 2024-11-23 06:16:09 -08:00 committed by GitHub
parent c0882aff84
commit 4cc0f9cc83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 53 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import (
)
func Test_service_parseMacros(t *testing.T) {
t.Parallel()
type args struct {
release domain.Release
action *domain.Action
@ -67,6 +68,7 @@ func Test_service_parseMacros(t *testing.T) {
}
func Test_service_execCmd(t *testing.T) {
t.Parallel()
type args struct {
release domain.Release
action *domain.Action

View file

@ -13,6 +13,7 @@ import (
)
func TestAppConfig_processLines(t *testing.T) {
t.Parallel()
type fields struct {
Config *domain.Config
m *sync.Mutex

View file

@ -10,6 +10,7 @@ import (
)
func TestDownloadClient_qbitBuildLegacyHost(t *testing.T) {
t.Parallel()
type fields struct {
ID int32
Name string

View file

@ -10,6 +10,7 @@ import (
)
func TestFilter_CheckFilter(t *testing.T) {
t.Parallel()
type args struct {
filter Filter
rejectionReasons *RejectionReasons
@ -1443,6 +1444,7 @@ func TestFilter_CheckFilter(t *testing.T) {
}
func TestFilter_CheckFilter1(t *testing.T) {
t.Parallel()
type fields Filter
type args struct {
r *Release
@ -2069,6 +2071,7 @@ func TestFilter_CheckFilter1(t *testing.T) {
}
func Test_containsMatch(t *testing.T) {
t.Parallel()
type args struct {
tags []string
filters []string
@ -2092,6 +2095,7 @@ func Test_containsMatch(t *testing.T) {
}
func Test_containsAllMatch(t *testing.T) {
t.Parallel()
type args struct {
tags []string
filters []string
@ -2117,6 +2121,7 @@ func Test_containsAllMatch(t *testing.T) {
}
func Test_contains(t *testing.T) {
t.Parallel()
type args struct {
tag string
filter string
@ -2144,6 +2149,7 @@ func Test_contains(t *testing.T) {
}
func Test_containsSlice(t *testing.T) {
t.Parallel()
type args struct {
tag string
filters []string
@ -2166,6 +2172,7 @@ func Test_containsSlice(t *testing.T) {
}
func Test_containsAny(t *testing.T) {
t.Parallel()
type args struct {
tags []string
filter string
@ -2187,6 +2194,7 @@ func Test_containsAny(t *testing.T) {
}
func Test_containsAll(t *testing.T) {
t.Parallel()
type args struct {
tags []string
filter string
@ -2212,6 +2220,7 @@ func Test_containsAll(t *testing.T) {
}
func Test_sliceContainsSlice(t *testing.T) {
t.Parallel()
type args struct {
tags []string
filters []string
@ -2235,6 +2244,7 @@ func Test_sliceContainsSlice(t *testing.T) {
}
func Test_containsIntStrings(t *testing.T) {
t.Parallel()
type args struct {
value int
filterList string
@ -2262,6 +2272,7 @@ func Test_containsIntStrings(t *testing.T) {
}
func Test_matchRegex(t *testing.T) {
t.Parallel()
type args struct {
tag string
filter string
@ -2289,6 +2300,7 @@ func Test_matchRegex(t *testing.T) {
}
func Test_validation(t *testing.T) {
t.Parallel()
tests := []struct {
name string
filter Filter
@ -2308,6 +2320,7 @@ func Test_validation(t *testing.T) {
}
func Test_checkSizeFilter(t *testing.T) {
t.Parallel()
tests := []struct {
name string
filter Filter
@ -2338,6 +2351,7 @@ func Test_checkSizeFilter(t *testing.T) {
}
func Test_containsFuzzy(t *testing.T) {
t.Parallel()
type args struct {
tag string
filter string

View file

@ -10,6 +10,7 @@ import (
)
func TestIndexerIRCParseMatch_ParseUrls(t *testing.T) {
t.Parallel()
type fields struct {
TorrentURL string
TorrentName string
@ -165,6 +166,7 @@ func TestIndexerIRCParseMatch_ParseUrls(t *testing.T) {
}
func TestIndexerIRCParseMatch_ParseTorrentName(t *testing.T) {
t.Parallel()
type fields struct {
TorrentURL string
TorrentName string
@ -238,6 +240,7 @@ func TestIndexerIRCParseMatch_ParseTorrentName(t *testing.T) {
}
func TestIRCParserGazelleGames_Parse(t *testing.T) {
t.Parallel()
type args struct {
rls *Release
vars map[string]string
@ -316,6 +319,7 @@ func TestIRCParserGazelleGames_Parse(t *testing.T) {
}
func TestIRCParserOrpheus_Parse(t *testing.T) {
t.Parallel()
type args struct {
rls *Release
vars map[string]string

View file

@ -12,6 +12,7 @@ import (
)
func TestMacros_Parse(t *testing.T) {
t.Parallel()
currentTime := time.Now()
type fields struct {

View file

@ -10,6 +10,7 @@ import (
)
func TestRejectionReasons_String(t *testing.T) {
t.Parallel()
type fields struct {
data []Rejection
}
@ -55,6 +56,7 @@ func TestRejectionReasons_String(t *testing.T) {
}
func TestRejectionReasons_StringTruncated(t *testing.T) {
t.Parallel()
type fields struct {
data []Rejection
}

View file

@ -10,6 +10,7 @@ import (
)
func TestParseReleaseTags(t *testing.T) {
t.Parallel()
type args struct {
tags []string
}
@ -29,6 +30,7 @@ func TestParseReleaseTags(t *testing.T) {
}
func TestParseReleaseTagString(t *testing.T) {
t.Parallel()
type args struct {
tags string
}
@ -64,6 +66,7 @@ func TestParseReleaseTagString(t *testing.T) {
}
func Test_cleanReleaseTags(t *testing.T) {
t.Parallel()
type args struct {
tagString string
}

View file

@ -17,6 +17,7 @@ import (
)
func TestRSSJob_processItem(t *testing.T) {
t.Parallel()
now := time.Now()
nowMinusTime := time.Now().Add(time.Duration(-3000) * time.Second)
@ -234,6 +235,7 @@ func TestRSSJob_processItem(t *testing.T) {
}
func Test_isMaxAge(t *testing.T) {
t.Parallel()
type args struct {
maxAge int
item time.Time

View file

@ -92,6 +92,7 @@ func setupAuthHandler() {
}
func TestAuthHandlerLogin(t *testing.T) {
t.Parallel()
logger := zerolog.Nop()
encoder := encoder{}
cookieStore := sessions.NewCookieStore([]byte("test"))
@ -153,6 +154,7 @@ func TestAuthHandlerLogin(t *testing.T) {
}
func TestAuthHandlerValidateOK(t *testing.T) {
t.Parallel()
logger := zerolog.Nop()
encoder := encoder{}
cookieStore := sessions.NewCookieStore([]byte("test"))
@ -224,6 +226,7 @@ func TestAuthHandlerValidateOK(t *testing.T) {
}
func TestAuthHandlerValidateBad(t *testing.T) {
t.Parallel()
logger := zerolog.Nop()
encoder := encoder{}
cookieStore := sessions.NewCookieStore([]byte("test"))
@ -271,6 +274,7 @@ func TestAuthHandlerValidateBad(t *testing.T) {
}
func TestAuthHandlerLoginBad(t *testing.T) {
t.Parallel()
logger := zerolog.Nop()
encoder := encoder{}
cookieStore := sessions.NewCookieStore([]byte("test"))

View file

@ -11,6 +11,7 @@ import (
)
func TestYamlExpectations(t *testing.T) {
t.Parallel()
s := &service{definitions: map[string]domain.IndexerDefinition{}}
err := s.LoadIndexerDefinitions()

View file

@ -14,6 +14,7 @@ import (
)
func TestIndexersParseAndFilter(t *testing.T) {
t.Parallel()
type fields struct {
identifier string
identifierExternal string

View file

@ -11,6 +11,7 @@ import (
)
func TestSanitizeLogFile(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
input string

View file

@ -4,13 +4,15 @@
package notification
import (
"github.com/autobrr/autobrr/internal/domain"
"github.com/stretchr/testify/assert"
"testing"
"time"
"github.com/autobrr/autobrr/internal/domain"
"github.com/stretchr/testify/assert"
)
func TestNotificationBuilderPlainText_BuildBody(t *testing.T) {
t.Parallel()
type args struct {
payload domain.NotificationPayload
}

View file

@ -10,6 +10,7 @@ import (
)
func TestCreateHash(t *testing.T) {
t.Parallel()
hashRX, err := regexp.Compile(`^\$argon2id\$v=19\$m=65536,t=1,p=2\$[A-Za-z0-9+/]{22}\$[A-Za-z0-9+/]{43}$`)
if err != nil {
t.Fatal(err)
@ -35,6 +36,7 @@ func TestCreateHash(t *testing.T) {
}
func TestComparePasswordAndHash(t *testing.T) {
t.Parallel()
hash, err := CreateHash("pa$$word", DefaultParams)
if err != nil {
t.Fatal(err)
@ -60,6 +62,7 @@ func TestComparePasswordAndHash(t *testing.T) {
}
func TestDecodeHash(t *testing.T) {
t.Parallel()
hash, err := CreateHash("pa$$word", DefaultParams)
if err != nil {
t.Fatal(err)
@ -75,6 +78,7 @@ func TestDecodeHash(t *testing.T) {
}
func TestCheckHash(t *testing.T) {
t.Parallel()
hash, err := CreateHash("pa$$word", DefaultParams)
if err != nil {
t.Fatal(err)
@ -93,6 +97,7 @@ func TestCheckHash(t *testing.T) {
}
func TestStrictDecoding(t *testing.T) {
t.Parallel()
// "bug" valid hash: $argon2id$v=19$m=65536,t=1,p=2$UDk0zEuIzbt0x3bwkf8Bgw$ihSfHWUJpTgDvNWiojrgcN4E0pJdUVmqCEdRZesx9tE
ok, _, err := CheckHash("bug", "$argon2id$v=19$m=65536,t=1,p=2$UDk0zEuIzbt0x3bwkf8Bgw$ihSfHWUJpTgDvNWiojrgcN4E0pJdUVmqCEdRZesx9tE")
if err != nil {

View file

@ -5,6 +5,7 @@ import (
)
func TestStringAndFilterString(t *testing.T) {
t.Parallel()
tests := []struct {
name string
input string

View file

@ -10,6 +10,7 @@ import (
)
func TestGitHubReleaseChecker_checkNewVersion(t *testing.T) {
t.Parallel()
type fields struct {
Repo string
}
@ -112,6 +113,7 @@ func TestGitHubReleaseChecker_checkNewVersion(t *testing.T) {
}
func Test_isDevelop(t *testing.T) {
t.Parallel()
tests := []struct {
name string
version string

View file

@ -15,6 +15,7 @@ import (
// A '*' in a provided string will not result in matching the strings before and after the '*' of the string provided.
// Sample usage: In resource matching for bucket policy validation.
func TestMatch(t *testing.T) {
t.Parallel()
tests := []struct {
pattern string
text string
@ -151,6 +152,7 @@ func TestMatch(t *testing.T) {
}
func TestMatchSimple(t *testing.T) {
t.Parallel()
tests := []struct {
pattern string
name string
@ -183,6 +185,7 @@ func TestMatchSimple(t *testing.T) {
}
func TestMatchSliceSimple(t *testing.T) {
t.Parallel()
tests := []struct {
patterns []string
name string
@ -209,6 +212,7 @@ func TestMatchSliceSimple(t *testing.T) {
}
func TestMatchSlice(t *testing.T) {
t.Parallel()
tests := []struct {
patterns []string
name string