Skip to content

Commit

Permalink
fix TestNetworkServiceEndpointRegistrationExpiration test
Browse files Browse the repository at this point in the history
Signed-off-by: denis-tingaikin <[email protected]>
  • Loading branch information
denis-tingaikin committed Nov 10, 2023
1 parent 6875ba7 commit 3ed99f9
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ import (
"github.com/edwarnicke/grpcfd"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/kelseyhightower/envconfig"
"github.com/networkservicemesh/api/pkg/api/registry"
registryclient "github.com/networkservicemesh/sdk/pkg/registry/chains/client"
"github.com/networkservicemesh/sdk/pkg/registry/common/begin"
"github.com/networkservicemesh/sdk/pkg/registry/common/grpcmetadata"
"github.com/networkservicemesh/sdk/pkg/registry/common/refresh"
"github.com/networkservicemesh/sdk/pkg/registry/core/next"
"github.com/networkservicemesh/sdk/pkg/tools/log"
"github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
"github.com/networkservicemesh/sdk/pkg/tools/spire"
"github.com/networkservicemesh/sdk/pkg/tools/token"
"github.com/sirupsen/logrus"
"github.com/spiffe/go-spiffe/v2/bundle/x509bundle"
"github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig"
Expand All @@ -44,16 +54,6 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/health/grpc_health_v1"

"github.com/networkservicemesh/api/pkg/api/registry"
"github.com/networkservicemesh/sdk/pkg/registry/common/begin"
"github.com/networkservicemesh/sdk/pkg/registry/common/grpcmetadata"
"github.com/networkservicemesh/sdk/pkg/registry/common/refresh"
"github.com/networkservicemesh/sdk/pkg/registry/core/next"
"github.com/networkservicemesh/sdk/pkg/tools/log"
"github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
"github.com/networkservicemesh/sdk/pkg/tools/spire"
"github.com/networkservicemesh/sdk/pkg/tools/token"

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

Expand Down Expand Up @@ -242,20 +242,18 @@ func (t *RegistryTestSuite) TestNetworkServiceEndpointRegistration() {
func (t *RegistryTestSuite) TestNetworkServiceEndpointRegistrationExpiration() {
ctx, cancel := context.WithTimeout(t.ctx, 100*time.Second)
defer cancel()
cc, err := grpc.DialContext(ctx,
t.config.ListenOn[0].String(),
var dialOpts = []grpc.DialOption{
grpc.WithTransportCredentials(credentials.NewTLS(tlsconfig.MTLSClientConfig(t.x509source, t.x509bundle, tlsconfig.AuthorizeAny()))),
grpc.WithDefaultCallOptions(
grpc.WaitForReady(true),
grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(t.x509source, t.config.MaxTokenLifetime))),
),
grpcfd.WithChainStreamInterceptor(),
grpcfd.WithChainUnaryInterceptor(),
)
t.NoError(err)
client := next.NewNetworkServiceEndpointRegistryClient(
grpcmetadata.NewNetworkServiceEndpointRegistryClient(),
registry.NewNetworkServiceEndpointRegistryClient(cc),
}
client := registryclient.NewNetworkServiceEndpointRegistryClient(ctx,
registryclient.WithClientURL(&t.config.ListenOn[0]),
registryclient.WithDialOptions(dialOpts...),
)
expireTime := time.Now().Add(time.Second)
result, err := client.Register(context.Background(), &registry.NetworkServiceEndpoint{
Expand Down

0 comments on commit 3ed99f9

Please sign in to comment.