Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rename namespace-registry to conform to go standards and move registry db test #425

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/cache_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"github.com/pelicanplatform/pelican/daemon"
"github.com/pelicanplatform/pelican/director"
"github.com/pelicanplatform/pelican/metrics"
nsregistry "github.com/pelicanplatform/pelican/namespace-registry"
nsregistry "github.com/pelicanplatform/pelican/namespace_registry"
"github.com/pelicanplatform/pelican/param"
"github.com/pelicanplatform/pelican/utils"
"github.com/pelicanplatform/pelican/xrootd"
Expand Down
2 changes: 1 addition & 1 deletion cmd/namespace_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/lestrrat-go/jwx/v2/jwk"
"github.com/pelicanplatform/pelican/config"
nsregistry "github.com/pelicanplatform/pelican/namespace-registry"
nsregistry "github.com/pelicanplatform/pelican/namespace_registry"
"github.com/pelicanplatform/pelican/param"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cmd/namespace_registry_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/pkg/errors"

nsregistry "github.com/pelicanplatform/pelican/namespace-registry"
nsregistry "github.com/pelicanplatform/pelican/namespace_registry"
"github.com/pelicanplatform/pelican/web_ui"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
***************************************************************/

package main
package nsregistry

import (
"net/http/httptest"
Expand All @@ -26,7 +26,6 @@ import (

"github.com/gin-gonic/gin"
"github.com/pelicanplatform/pelican/config"
nsregistry "github.com/pelicanplatform/pelican/namespace-registry"
"github.com/spf13/viper"

"github.com/stretchr/testify/assert"
Expand All @@ -44,9 +43,9 @@ func TestServeNamespaceRegistry(t *testing.T) {
err := config.InitServer()
require.NoError(t, err)

err = nsregistry.InitializeDB()
err = InitializeDB()
require.NoError(t, err)
defer nsregistry.ShutdownDB()
defer ShutdownDB()

gin.SetMode(gin.TestMode)
engine := gin.Default()
Expand All @@ -57,7 +56,7 @@ func TestServeNamespaceRegistry(t *testing.T) {
require.NoError(t, err)

//Configure registry
nsregistry.RegisterNamespaceRegistry(engine.Group("/"))
RegisterNamespaceRegistry(engine.Group("/"))

//Set up a server to use for testing
svr := httptest.NewServer(engine)
Expand All @@ -68,7 +67,7 @@ func TestServeNamespaceRegistry(t *testing.T) {
viper.Set("Origin.NamespacePrefix", "/test")

//Test functionality of registering a namespace (without identity)
err = nsregistry.NamespaceRegister(privKey, svr.URL+"/api/v1.0/registry", "", "/test")
err = NamespaceRegister(privKey, svr.URL+"/api/v1.0/registry", "", "/test")
require.NoError(t, err)

//Test we can list the namespace without an error
Expand All @@ -80,7 +79,7 @@ func TestServeNamespaceRegistry(t *testing.T) {
os.Stdout = w

//List the namespaces
err = nsregistry.NamespaceList(svr.URL + "/api/v1.0/registry")
err = NamespaceList(svr.URL + "/api/v1.0/registry")
require.NoError(t, err)
w.Close()
os.Stdout = oldStdout
Expand All @@ -99,7 +98,7 @@ func TestServeNamespaceRegistry(t *testing.T) {
r, w, _ := os.Pipe()
os.Stdout = w

err = nsregistry.NamespaceGet(svr.URL + "/api/v1.0/registry")
err = NamespaceGet(svr.URL + "/api/v1.0/registry")
require.NoError(t, err)
w.Close()
os.Stdout = oldStdout
Expand All @@ -112,13 +111,13 @@ func TestServeNamespaceRegistry(t *testing.T) {

t.Run("Test namespace delete", func(t *testing.T) {
//Test functionality of namespace delete
err = nsregistry.NamespaceDelete(svr.URL+"/api/v1.0/registry/test", "/test")
err = NamespaceDelete(svr.URL+"/api/v1.0/registry/test", "/test")
require.NoError(t, err)
var stdoutCapture string
oldStdout := os.Stdout
r, w, _ := os.Pipe()
os.Stdout = w
err = nsregistry.NamespaceGet(svr.URL + "/api/v1.0/registry")
err = NamespaceGet(svr.URL + "/api/v1.0/registry")
require.NoError(t, err)
w.Close()
os.Stdout = oldStdout
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion origin_ui/register_origin.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/lestrrat-go/jwx/v2/jwk"
"github.com/pelicanplatform/pelican/config"
"github.com/pelicanplatform/pelican/metrics"
nsregistry "github.com/pelicanplatform/pelican/namespace-registry"
nsregistry "github.com/pelicanplatform/pelican/namespace_registry"
"github.com/pelicanplatform/pelican/param"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion origin_ui/register_origin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/lestrrat-go/jwx/v2/jwk"
"github.com/pelicanplatform/pelican/config"
nsregistry "github.com/pelicanplatform/pelican/namespace-registry"
nsregistry "github.com/pelicanplatform/pelican/namespace_registry"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down