From 878edb0ddf4c6b6a1cfc623faa9867f9d213c3e4 Mon Sep 17 00:00:00 2001 From: Thy Ton Date: Mon, 10 Jun 2024 11:37:17 -0700 Subject: [PATCH] use t.Fatalf instead of t.Errof in registry_full_test.go --- helper/builtinplugins/registry_full_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/helper/builtinplugins/registry_full_test.go b/helper/builtinplugins/registry_full_test.go index 2f4938be0097..d726442fecd7 100644 --- a/helper/builtinplugins/registry_full_test.go +++ b/helper/builtinplugins/registry_full_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_newRegistry(t *testing.T) { @@ -14,11 +15,11 @@ func Test_newRegistry(t *testing.T) { 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") @@ -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) } } }