Skip to content

Commit

Permalink
Adapt to changes in sdk:pkg/tools/spire
Browse files Browse the repository at this point in the history
networkservicemesh/sdk#258

Signed-off-by: Ed Warnicke <hagbard@gmail.com>
  • Loading branch information
edwarnicke committed May 27, 2020
1 parent 1f2cad1 commit 8ded339
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -6,8 +6,8 @@ require (
github.com/antonfisher/nested-logrus-formatter v1.0.3
github.com/edwarnicke/exechelper v1.0.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/networkservicemesh/sdk v0.0.0-20200527163028-6d771f4c0d5d
github.com/networkservicemesh/sdk-vppagent v0.0.0-20200527163408-6af225c0b749
github.com/networkservicemesh/sdk v0.0.0-20200527213229-392d4af0d479
github.com/networkservicemesh/sdk-vppagent v0.0.0-20200527214155-b194114ab5be
github.com/open-policy-agent/opa v0.16.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.6.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Expand Up @@ -265,10 +265,10 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
github.com/nats-io/stan.go v0.6.0/go.mod h1:eIcD5bi3pqbHT/xIIvXMwvzXYElgouBvaVRftaE+eac=
github.com/networkservicemesh/api v0.0.0-20200525170518-89690ec70489 h1:xvLyZpjsa4qwvqTxnt2v7JYXdbTM7AEgrbwNySKciRM=
github.com/networkservicemesh/api v0.0.0-20200525170518-89690ec70489/go.mod h1:6hH0TfujZVin9W/6rWY7JnmNBNRvUrgXhr1aWyKuQKI=
github.com/networkservicemesh/sdk v0.0.0-20200527163028-6d771f4c0d5d h1:+m0cZve+4DUCyDTzu+KBudj8wlz3xigzg7pCIEfLXhU=
github.com/networkservicemesh/sdk v0.0.0-20200527163028-6d771f4c0d5d/go.mod h1:LtIWa5CYbvzQx9JQFyxgH69QmSucCwxF3EIQuFBttNA=
github.com/networkservicemesh/sdk-vppagent v0.0.0-20200527163408-6af225c0b749 h1:q+HB7p8jbelSCheBz7HUJd3MTTverXE9KTpq7ZQ9zYA=
github.com/networkservicemesh/sdk-vppagent v0.0.0-20200527163408-6af225c0b749/go.mod h1:5g3vlru4rH1Elc5d1J5LJklEsK71wuTMdw0Fx1JWayg=
github.com/networkservicemesh/sdk v0.0.0-20200527213229-392d4af0d479 h1:O/aVN0bpV8XNF9AxY6IzsBejzK9/3JnB50bk6Syll9g=
github.com/networkservicemesh/sdk v0.0.0-20200527213229-392d4af0d479/go.mod h1:LtIWa5CYbvzQx9JQFyxgH69QmSucCwxF3EIQuFBttNA=
github.com/networkservicemesh/sdk-vppagent v0.0.0-20200527214155-b194114ab5be h1:fomPuuDmGTVjnTRHchRJE79CyLCICOYcIbGIFrqsk48=
github.com/networkservicemesh/sdk-vppagent v0.0.0-20200527214155-b194114ab5be/go.mod h1:rz9OSLo+MHtbYCguZt2HHnTQYoKHz+u11pe4SKaDthQ=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
Expand Down
2 changes: 2 additions & 0 deletions internal/imports/imports.go
Expand Up @@ -4,6 +4,7 @@ package imports
import (
_ "bufio"
_ "context"
_ "fmt"
_ "github.com/antonfisher/nested-logrus-formatter"
_ "github.com/edwarnicke/exechelper"
_ "github.com/kelseyhightower/envconfig"
Expand Down Expand Up @@ -32,6 +33,7 @@ import (
_ "net"
_ "net/url"
_ "os"
_ "path/filepath"
_ "strconv"
_ "strings"
_ "testing"
Expand Down
18 changes: 11 additions & 7 deletions main_test.go
Expand Up @@ -18,7 +18,9 @@ package main_test

import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
"time"

Expand Down Expand Up @@ -54,16 +56,18 @@ func (f *ForwarderTestSuite) SetupSuite() {
f.ctx, f.cancel = context.WithCancel(context.Background())

// Run spire
agentID := "spiffe://example.org/myagent"
f.spireErrCh = spire.Start(f.ctx, agentID)
executable, err := os.Executable()
require.NoError(f.T(), err)
f.spireErrCh = spire.Start(
spire.WithContext(f.ctx),
spire.WithEntry("spiffe://example.org/forwarder", "unix:path:/bin/forwarder"),
spire.WithEntry(fmt.Sprintf("spiffe://example.org/%s", filepath.Base(executable)),
fmt.Sprintf("unix:path:%s", executable),
),
)
require.Len(f.T(), f.spireErrCh, 0)

// Add spire entries
require.NoError(f.T(), spire.AddEntry(f.ctx, agentID, "spiffe://example.org/forwarder", "unix:path:/bin/forwarder"))
require.NoError(f.T(), spire.AddEntry(f.ctx, agentID, "spiffe://example.org/forwarder.test", "unix:uid:0"))

// Get tslPeer
var err error
f.tlsPeer, err = spiffeutils.NewTLSPeer()
require.NoError(f.T(), err)

Expand Down

0 comments on commit 8ded339

Please sign in to comment.