Skip to content

Commit

Permalink
Fix final few issues resulting from rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiemstrawisc committed Oct 4, 2023
1 parent a34d226 commit e4ab2c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions director/origin_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func TestVerifyAdvertiseToken(t *testing.T) {
//Setup a private key and a token
viper.Set("IssuerKey", kfile)

viper.Set("NamespaceURL", "https://get-your-tokens.org")
viper.Set("DirectorURL", "https://director-url.org")
viper.Set("Federation.NamespaceURL", "https://get-your-tokens.org")
viper.Set("Federation.DirectorURL", "https://director-url.org")

kSet, err := config.LoadPublicKey("", kfile)
ar := MockCache{
Expand Down Expand Up @@ -128,13 +128,13 @@ func TestCreateAdvertiseToken(t *testing.T) {
tok, err := CreateAdvertiseToken("test-namespace")
assert.Equal(t, "", tok)
assert.Equal(t, "Namespace URL is not set", err.Error())
viper.Set("NamespaceURL", "https://get-your-tokens.org")
viper.Set("Federation.NamespaceURL", "https://get-your-tokens.org")

// Test without a DirectorURL set and check to see if it returns the expected error
tok, err = CreateAdvertiseToken("test-namespace")
assert.Equal(t, "", tok)
assert.Equal(t, "Director URL is not known; cannot create advertise token", err.Error())
viper.Set("DirectorURL", "https://director-url.org")
viper.Set("Federation.DirectorURL", "https://director-url.org")

// Test the CreateAdvertiseToken with good values and test that it returns a non-nil token value and no error
tok, err = CreateAdvertiseToken("test-namespace")
Expand All @@ -154,7 +154,7 @@ func TestGetIssuerURL(t *testing.T) {
assert.Equal(t, "Namespace URL is not set", err.Error())

// Test to make sure the path is as expected
viper.Set("NamespaceURL", "test-path")
viper.Set("Federation.NamespaceURL", "test-path")
url, err = GetIssuerURL("test-prefix")
assert.Equal(t, nil, err)
assert.Equal(t, "test-path/api/v1.0/registry/test-prefix/.well-known/issuer.jwks", url)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ require (
golang.org/x/net v0.12.0
golang.org/x/oauth2 v0.10.0
golang.org/x/term v0.10.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
kernel.org/pub/linux/libs/security/libcap/cap v1.2.69
modernc.org/sqlite v1.25.0
Expand Down Expand Up @@ -152,6 +151,7 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
kernel.org/pub/linux/libs/security/libcap/psx v1.2.69 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions xrootd/authorization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ var (

func TestEmitCfg(t *testing.T) {
dirname := t.TempDir()
os.Setenv("PELICAN_XROOTD_RUNLOCATION", dirname)
defer os.Unsetenv("PELICAN_XROOTD_RUNLOCATION")
viper.Reset()
viper.Set("Xrootd.RunLocation", dirname)
err := config.InitClient()
assert.Nil(t, err)

Expand All @@ -85,9 +84,8 @@ func TestEmitCfg(t *testing.T) {

func TestLoadScitokensConfig(t *testing.T) {
dirname := t.TempDir()
os.Setenv("PELICAN_XROOTD_RUNLOCATION", dirname)
defer os.Unsetenv("PELICAN_XROOTD_RUNLOCATION")
viper.Reset()
viper.Set("Xrootd.RunLocation", dirname)
err := config.InitClient()
assert.Nil(t, err)

Expand Down

0 comments on commit e4ab2c1

Please sign in to comment.