mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-24 19:36:24 +02:00
chore(updater): move updater packages to pkg/updaters/<name>
This commit is contained in:
@@ -3,7 +3,9 @@ package providers
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/qdm12/gluetun/pkg/updaters"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_All(t *testing.T) {
|
||||
@@ -21,3 +23,27 @@ func Test_AllWithCustom(t *testing.T) {
|
||||
assert.Contains(t, all, Custom)
|
||||
assert.Len(t, all, len(All())+1)
|
||||
}
|
||||
|
||||
func Test_MatchUpdaters(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fetcherNames := updaters.ListAllNames()
|
||||
|
||||
allProviders := All()
|
||||
require.Equal(t, len(allProviders), len(fetcherNames), "number of providers in All() should match number of fetchers")
|
||||
nameToFound := make(map[string]bool, len(allProviders))
|
||||
for _, provider := range allProviders {
|
||||
nameToFound[provider] = false
|
||||
}
|
||||
|
||||
for _, fetcherName := range fetcherNames {
|
||||
found, ok := nameToFound[fetcherName]
|
||||
require.True(t, ok, "fetcher name %q not found in %v", fetcherName, allProviders)
|
||||
require.False(t, found, "fetcher name %q is duplicated in %v", fetcherName, allProviders)
|
||||
nameToFound[fetcherName] = true
|
||||
}
|
||||
|
||||
for provider, found := range nameToFound {
|
||||
assert.True(t, found, "provider %q from All() does not have a matching fetcher", provider)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user