Skip to content

Commit

Permalink
fix errors and linter issues`
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Tingajkin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin committed Aug 18, 2020
1 parent 97268d9 commit 13f6b95
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ import (

nested "github.com/antonfisher/nested-logrus-formatter"
"github.com/kelseyhightower/envconfig"
api_registry "github.com/networkservicemesh/api/pkg/api/registry"
"github.com/sirupsen/logrus"
"github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig"
"github.com/spiffe/go-spiffe/v2/workloadapi"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"

api_registry "github.com/networkservicemesh/api/pkg/api/registry"

"github.com/networkservicemesh/sdk/pkg/registry/common/setid"

"github.com/networkservicemesh/sdk/pkg/registry/core/chain"
Expand All @@ -51,7 +52,7 @@ import (

// Config is configuration for cmd-registry-memory
type Config struct {
ListenOn []url.URL `default:"[unix:///var/lib/networkservicemesh/registry.sock" desc:"url to listen on." split_words:"true"`
ListenOn []url.URL `default:"[unix://registry.sock]" desc:"url to listen on." split_words:"true"`
ProxyRegistryURL url.URL `desc:"url to the proxy registry that handles this domain" split_words:"true"`
ExpirePeriod time.Duration `default:"1s" desc:"period to check expired NSEs" split_words:"true"`
}
Expand Down
15 changes: 8 additions & 7 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
nested "github.com/antonfisher/nested-logrus-formatter"
"github.com/edwarnicke/exechelper"
"github.com/kelseyhightower/envconfig"
"github.com/networkservicemesh/api/pkg/api/registry"
"github.com/spiffe/go-spiffe/v2/bundle/x509bundle"
"github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig"
"github.com/spiffe/go-spiffe/v2/svid/x509svid"
Expand All @@ -46,6 +45,8 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/health/grpc_health_v1"

"github.com/networkservicemesh/api/pkg/api/registry"

main "github.com/networkservicemesh/cmd-registry-memory"

"github.com/networkservicemesh/sdk/pkg/tools/spire"
Expand Down Expand Up @@ -101,7 +102,7 @@ func (t *RegistryTestSuite) SetupSuite() {
require.Len(t.T(), t.sutErrCh, 0)

// Get config from env
require.NoError(t.T(), envconfig.Process("nsm", &t.config))
require.NoError(t.T(), envconfig.Process("registry-memory", &t.config))
}

func (t *RegistryTestSuite) TearDownSuite() {
Expand All @@ -124,7 +125,7 @@ func (t *RegistryTestSuite) TestHealthCheck() {
ctx, cancel := context.WithTimeout(t.ctx, 100*time.Second)
defer cancel()
healthCC, err := grpc.DialContext(ctx,
t.config.ListenOn.String(),
t.config.ListenOn[0].String(),
grpc.WithTransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(t.x509source, t.x509bundle, tlsconfig.AuthorizeAny()))),
)
if err != nil {
Expand Down Expand Up @@ -155,7 +156,7 @@ func (t *RegistryTestSuite) TestNetworkServiceRegistration() {
ctx, cancel := context.WithTimeout(t.ctx, 100*time.Second)
defer cancel()
cc, err := grpc.DialContext(ctx,
t.config.ListenOn.String(),
t.config.ListenOn[0].String(),
grpc.WithTransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(t.x509source, t.x509bundle, tlsconfig.AuthorizeAny()))),
)
t.NoError(err)
Expand All @@ -182,7 +183,7 @@ func (t *RegistryTestSuite) TestNetworkServiceEndpointRegistration() {
ctx, cancel := context.WithTimeout(t.ctx, 100*time.Second)
defer cancel()
cc, err := grpc.DialContext(ctx,
t.config.ListenOn.String(),
t.config.ListenOn[0].String(),
grpc.WithTransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(t.x509source, t.x509bundle, tlsconfig.AuthorizeAny()))),
)
t.NoError(err)
Expand Down Expand Up @@ -219,7 +220,7 @@ func (t *RegistryTestSuite) TestNetworkServiceEndpointRegistrationExpiration() {
ctx, cancel := context.WithTimeout(t.ctx, 100*time.Second)
defer cancel()
cc, err := grpc.DialContext(ctx,
t.config.ListenOn.String(),
t.config.ListenOn[0].String(),
grpc.WithTransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(t.x509source, t.x509bundle, tlsconfig.AuthorizeAny()))),
)
t.NoError(err)
Expand Down Expand Up @@ -252,7 +253,7 @@ func (t *RegistryTestSuite) TestNetworkServiceEndpointClientRefreshingTime() {
ctx, cancel := context.WithTimeout(t.ctx, 100*time.Second)
defer cancel()
cc, err := grpc.DialContext(ctx,
t.config.ListenOn.String(),
t.config.ListenOn[0].String(),
grpc.WithTransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(t.x509source, t.x509bundle, tlsconfig.AuthorizeAny()))),
)
t.NoError(err)
Expand Down
5 changes: 3 additions & 2 deletions pkg/imports/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
_ "github.com/edwarnicke/exechelper"
_ "github.com/golang/protobuf/ptypes/timestamp"
_ "github.com/kelseyhightower/envconfig"
_ "github.com/networkservicemesh/api/pkg/api"
_ "github.com/networkservicemesh/api/pkg/api/registry"
_ "github.com/sirupsen/logrus"
_ "github.com/spiffe/go-spiffe/v2/bundle/x509bundle"
_ "github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig"
Expand All @@ -28,6 +26,9 @@ import (
_ "google.golang.org/grpc/health"
_ "google.golang.org/grpc/health/grpc_health_v1"

_ "github.com/networkservicemesh/api/pkg/api"
_ "github.com/networkservicemesh/api/pkg/api/registry"

_ "github.com/networkservicemesh/sdk/pkg/networkservice/chains/registry"
_ "github.com/networkservicemesh/sdk/pkg/registry/common/expire"
_ "github.com/networkservicemesh/sdk/pkg/registry/common/setid"
Expand Down

0 comments on commit 13f6b95

Please sign in to comment.