Skip to content

Commit

Permalink
use t.Fatalf instead of t.Errof in registry_full_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
thyton committed Jun 10, 2024
1 parent 9405cc7 commit 878edb0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions helper/builtinplugins/registry_full_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func Test_newRegistry(t *testing.T) {

Check failure on line 13 in helper/builtinplugins/registry_full_test.go

View workflow job for this annotation

GitHub Actions / Code checks

Test Test_newRegistry is missing a go doc
actual := newRegistry()
expMinimal := newMinimalRegistry()
expFullAddon := newFullAddonRegistry()

assert.Equal(t, len(expMinimal.credentialBackends)+len(expFullAddon.credentialBackends), len(actual.credentialBackends),
require.Equal(t, len(expMinimal.credentialBackends)+len(expFullAddon.credentialBackends), len(actual.credentialBackends),
"newRegistry() total auth backends mismatch total of common and full addon registries")
assert.Equal(t, len(expMinimal.databasePlugins)+len(expFullAddon.databasePlugins), len(actual.databasePlugins),
require.Equal(t, len(expMinimal.databasePlugins)+len(expFullAddon.databasePlugins), len(actual.databasePlugins),
"newRegistry() total database plugins mismatch total of common and full addon registries")
assert.Equal(t, len(expMinimal.logicalBackends)+len(expFullAddon.logicalBackends), len(actual.logicalBackends),
require.Equal(t, len(expMinimal.logicalBackends)+len(expFullAddon.logicalBackends), len(actual.logicalBackends),
"newRegistry() total logical backends mismatch total of common and full addon registries")

assertRegistrySubset(t, actual, expMinimal, "common")
Expand All @@ -30,19 +31,19 @@ func assertRegistrySubset(t *testing.T, r, subset *registry, subsetName string)

for k := range subset.credentialBackends {
if !assert.Contains(t, r.credentialBackends, k) {
t.Errorf("missing %s auth backend=%v, newRegistry()=%v", subsetName, k, r.credentialBackends)
t.Fatalf("missing %s auth backend=%v, newRegistry()=%v", subsetName, k, r.credentialBackends)
}
}

for k := range subset.databasePlugins {
if !assert.Contains(t, r.databasePlugins, k) {
t.Errorf("missing %s database plugin=%v, newRegistry()=%v", subsetName, k, r.databasePlugins)
t.Fatalf("missing %s database plugin=%v, newRegistry()=%v", subsetName, k, r.databasePlugins)
}
}

for k := range subset.logicalBackends {
if !assert.Contains(t, r.logicalBackends, k) {
t.Errorf("missing %s logical backend=%v, newRegistry()=%v", subsetName, k, r.logicalBackends)
t.Fatalf("missing %s logical backend=%v, newRegistry()=%v", subsetName, k, r.logicalBackends)
}
}
}

0 comments on commit 878edb0

Please sign in to comment.