diff --git a/client/handle_http_test.go b/client/handle_http_test.go index 4d7ac9a8f..4e522a438 100644 --- a/client/handle_http_test.go +++ b/client/handle_http_test.go @@ -527,7 +527,8 @@ func TestNewPelicanURL(t *testing.T) { viper.Reset() viper.Set("TLSSkipVerify", true) config.InitConfig() - config.InitClient() + err := config.InitClient() + assert.NoError(t, err) // Create a server that gives us a mock response server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // make our response: diff --git a/config/config.go b/config/config.go index 8b36d7779..4f15ecc3a 100644 --- a/config/config.go +++ b/config/config.go @@ -156,6 +156,7 @@ var ( string(Pelican): true, string(OSDF): true, string(Stash): true, + "": true, } ) diff --git a/namespaces/namespaces_test.go b/namespaces/namespaces_test.go index d9255d9a6..ada8cba5f 100644 --- a/namespaces/namespaces_test.go +++ b/namespaces/namespaces_test.go @@ -27,6 +27,7 @@ import ( "os" "testing" + log "github.com/sirupsen/logrus" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -103,7 +104,12 @@ func TestMatchNamespace(t *testing.T) { // Reset the prefix to get old OSDF fallback behavior. oldPrefix, err := config.SetPreferredPrefix("OSDF") assert.NoError(t, err) - defer config.SetPreferredPrefix(oldPrefix) + defer func() { + _, err := config.SetPreferredPrefix(oldPrefix) + if err != nil { + log.Errorln(err) + } + }() viper.Reset() err = config.InitClient() @@ -251,7 +257,12 @@ func TestGetNamespaces(t *testing.T) { os.Setenv("OSDF_TOPOLOGY_NAMESPACE_URL", "https://doesnotexist.org.blah/namespaces.json") oldPrefix, err := config.SetPreferredPrefix("OSDF") assert.NoError(t, err) - defer config.SetPreferredPrefix(oldPrefix) + defer func() { + _, err := config.SetPreferredPrefix(oldPrefix) + if err != nil { + log.Errorln(err) + } + }() viper.Reset() err = config.InitClient() assert.Nil(t, err) diff --git a/xrootd/authorization_test.go b/xrootd/authorization_test.go index e2e240a49..6207bc3f1 100644 --- a/xrootd/authorization_test.go +++ b/xrootd/authorization_test.go @@ -43,6 +43,7 @@ import ( "github.com/pelicanplatform/pelican/server_structs" "github.com/pelicanplatform/pelican/server_utils" "github.com/pelicanplatform/pelican/test_utils" + log "github.com/sirupsen/logrus" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -278,7 +279,12 @@ func TestOSDFAuthCreation(t *testing.T) { } oldPrefix, err := config.SetPreferredPrefix("OSDF") assert.NoError(t, err) - defer config.SetPreferredPrefix(oldPrefix) + defer func() { + _, err := config.SetPreferredPrefix(oldPrefix) + if err != nil { + log.Errorln(err) + } + }() err = os.WriteFile(filepath.Join(dirName, "authfile"), []byte(testInput.authIn), fs.FileMode(0600)) require.NoError(t, err, "Failure writing test input authfile")