Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 2ff3c1a

Browse files
committed
Fixup
1 parent f041971 commit 2ff3c1a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package config
33

44
import (
5-
"path"
5+
"path/filepath"
66
"strconv"
77
"strings"
88
"os"
@@ -43,7 +43,7 @@ type OSDFConfig struct {
4343
// need to manually configure the location of the director endpoint.
4444
//
4545
func GetPreferredPrefix() string {
46-
arg0 := strings.ToUpper(path.Base(os.Args[0]))
46+
arg0 := strings.ToUpper(filepath.Base(os.Args[0]))
4747
log.Errorln("Current arg0:", arg0)
4848
underscore_idx := strings.Index(arg0, "_")
4949
if underscore_idx != -1 {

namespaces_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ func TestMatchNamespace(t *testing.T) {
7373
t.Error(err)
7474
}
7575
viper.Reset()
76-
config.Init()
76+
err = config.Init()
77+
assert.Nil(t, err)
7778

7879
ns, err := MatchNamespace("/osgconnect/private/path/to/file.txt")
7980
assert.NoError(t, err, "Failed to parse namespace")
@@ -158,7 +159,8 @@ func TestFullNamespace(t *testing.T) {
158159
func TestDownloadNamespaces(t *testing.T) {
159160
os.Setenv("STASH_NAMESPACE_URL", "https://topology-itb.opensciencegrid.org/stashcache/namespaces")
160161
viper.Reset()
161-
config.Init()
162+
err := config.Init()
163+
assert.Nil(t, err)
162164
fmt.Printf("Prefix %s; STASH_NAMESPACE_URL: %s; config NamespaceURL: %s", config.GetPreferredPrefix(), os.Getenv("STASH_NAMESPACE_URL"), viper.GetString("NamespaceURL"))
163165
defer os.Unsetenv("STASH_NAMESPACE_URL")
164166
namespaceBytes, err := downloadNamespace()
@@ -170,7 +172,8 @@ func TestDownloadNamespaces(t *testing.T) {
170172
func TestDownloadNamespacesFail(t *testing.T) {
171173
os.Setenv("STASH_NAMESPACE_URL", "https://doesnotexist.org.blah/namespaces.json")
172174
viper.Reset()
173-
config.Init()
175+
err := config.Init()
176+
assert.Nil(t, err)
174177
defer os.Unsetenv("STASH_NAMESPACE_URL")
175178
namespaceBytes, err := downloadNamespace()
176179
assert.Error(t, err, "Failed to download namespaces")
@@ -181,7 +184,8 @@ func TestGetNamespaces(t *testing.T) {
181184
// Set the environment to an invalid URL, so it is forced to use the "built-in" namespaces.json
182185
os.Setenv("STASH_NAMESPACE_URL", "https://doesnotexist.org.blah/namespaces.json")
183186
viper.Reset()
184-
config.Init()
187+
err := config.Init()
188+
assert.Nil(t, err)
185189
defer os.Unsetenv("STASH_NAMESPACE_URL")
186190
namespaces, err := GetNamespaces()
187191
assert.NoError(t, err, "Failed to get namespaces")

0 commit comments

Comments
 (0)