Skip to content

Commit

Permalink
Restructure location of various ncproxy apis to accomodate future cha…
Browse files Browse the repository at this point in the history
…nges

Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
  • Loading branch information
katiewasnothere committed Nov 22, 2021
1 parent 3b78eb3 commit 2b756cf
Show file tree
Hide file tree
Showing 18 changed files with 331 additions and 299 deletions.
4 changes: 2 additions & 2 deletions cmd/ncproxy/ncproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"time"

"github.com/Microsoft/go-winio"
"github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc"
"github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc"
"github.com/Microsoft/hcsshim/hcn"
"github.com/Microsoft/hcsshim/internal/computeagent"
"github.com/Microsoft/hcsshim/internal/log"
"github.com/Microsoft/hcsshim/internal/ncproxyttrpc"
"github.com/Microsoft/hcsshim/internal/oc"
"github.com/Microsoft/hcsshim/internal/uvm"
ncproxygrpc "github.com/Microsoft/hcsshim/pkg/ncproxy/ncproxygrpc/v1"
nodenetsvc "github.com/Microsoft/hcsshim/pkg/ncproxy/nodenetsvc/v1"
"github.com/Microsoft/hcsshim/pkg/octtrpc"
"github.com/containerd/ttrpc"
"github.com/pkg/errors"
Expand Down
1 change: 0 additions & 1 deletion cmd/ncproxy/ncproxygrpc/doc.go

This file was deleted.

1 change: 0 additions & 1 deletion cmd/ncproxy/nodenetsvc/doc.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/ncproxy/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"github.com/Microsoft/go-winio/pkg/etw"
"github.com/Microsoft/go-winio/pkg/etwlogrus"
"github.com/Microsoft/go-winio/pkg/guid"
"github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc"
"github.com/Microsoft/hcsshim/internal/computeagent"
"github.com/Microsoft/hcsshim/internal/debug"
"github.com/Microsoft/hcsshim/internal/log"
"github.com/Microsoft/hcsshim/internal/oc"
nodenetsvc "github.com/Microsoft/hcsshim/pkg/ncproxy/nodenetsvc/v1"
"github.com/containerd/ttrpc"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ncproxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"sync"

"github.com/Microsoft/go-winio"
"github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc"
"github.com/Microsoft/hcsshim/internal/log"
"github.com/Microsoft/hcsshim/internal/ncproxyttrpc"
ncproxygrpc "github.com/Microsoft/hcsshim/pkg/ncproxy/ncproxygrpc/v1"
"github.com/Microsoft/hcsshim/pkg/octtrpc"
"github.com/containerd/ttrpc"
"github.com/pkg/errors"
Expand Down
17 changes: 9 additions & 8 deletions cmd/ncproxy/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"testing"
"time"

ncproxyMock "github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxy_mock"
"github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc"
"github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc"
"github.com/Microsoft/hcsshim/hcn"
"github.com/Microsoft/hcsshim/internal/computeagent"
computeagentMock "github.com/Microsoft/hcsshim/internal/computeagent/mock"
"github.com/Microsoft/hcsshim/internal/ncproxyttrpc"
"github.com/Microsoft/hcsshim/osversion"
ncproxygrpc "github.com/Microsoft/hcsshim/pkg/ncproxy/ncproxygrpc/v1"
nodenetsvc "github.com/Microsoft/hcsshim/pkg/ncproxy/nodenetsvc/v1"
nodenetsvcMock "github.com/Microsoft/hcsshim/pkg/ncproxy/nodenetsvc/v1/mock"
"github.com/containerd/ttrpc"
"github.com/golang/mock/gomock"
"github.com/pkg/errors"
Expand Down Expand Up @@ -112,7 +113,7 @@ func TestAddNIC(t *testing.T) {
// create mocked compute agent service
computeAgentCtrl := gomock.NewController(t)
defer computeAgentCtrl.Finish()
mockedService := ncproxyMock.NewMockComputeAgentService(computeAgentCtrl)
mockedService := computeagentMock.NewMockComputeAgentService(computeAgentCtrl)
mockedAgentClient := &computeAgentClient{nil, mockedService}

// put mocked compute agent in agent cache for test
Expand Down Expand Up @@ -197,7 +198,7 @@ func TestDeleteNIC(t *testing.T) {
// create mocked compute agent service
computeAgentCtrl := gomock.NewController(t)
defer computeAgentCtrl.Finish()
mockedService := ncproxyMock.NewMockComputeAgentService(computeAgentCtrl)
mockedService := computeagentMock.NewMockComputeAgentService(computeAgentCtrl)
mockedAgentClient := &computeAgentClient{nil, mockedService}

// put mocked compute agent in agent cache for test
Expand Down Expand Up @@ -284,7 +285,7 @@ func TestModifyNIC(t *testing.T) {
// create mock compute agent service
computeAgentCtrl := gomock.NewController(t)
defer computeAgentCtrl.Finish()
mockedService := ncproxyMock.NewMockComputeAgentService(computeAgentCtrl)
mockedService := computeagentMock.NewMockComputeAgentService(computeAgentCtrl)
mockedAgentClient := &computeAgentClient{nil, mockedService}

// populate agent cache with mocked service for test
Expand Down Expand Up @@ -1111,7 +1112,7 @@ func TestConfigureNetworking(t *testing.T) {
// setup mocked client and mocked calls for nodenetsvc
nodeNetCtrl := gomock.NewController(t)
defer nodeNetCtrl.Finish()
mockedClient := ncproxyMock.NewMockNodeNetworkServiceClient(nodeNetCtrl)
mockedClient := nodenetsvcMock.NewMockNodeNetworkServiceClient(nodeNetCtrl)
nodeNetSvcClient = &nodeNetSvcConn{
addr: "",
client: mockedClient,
Expand Down Expand Up @@ -1283,7 +1284,7 @@ func TestDisconnectComputeAgents(t *testing.T) {
// create mocked compute agent service
computeAgentCtrl := gomock.NewController(t)
defer computeAgentCtrl.Finish()
mockedService := ncproxyMock.NewMockComputeAgentService(computeAgentCtrl)
mockedService := computeagentMock.NewMockComputeAgentService(computeAgentCtrl)
mockedAgentClient := &computeAgentClient{nil, mockedService}

// put mocked compute agent in agent cache for test
Expand Down
10 changes: 10 additions & 0 deletions internal/computeagent/doc.go
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
// This package contains the proto and compiled go files for the compute
// agent service.
//
// A mock service under `mock` is used for unit testing the various services
// used for ncproxy.
//
// The mock service is compiled using the following command:
//
// mockgen -source="computeagent.pb.go" -package="computeagent_mock" > mock\computeagent_mock.pb.go

package computeagent

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/tools/networkagent/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"io/ioutil"

"github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc"
ncproxygrpc "github.com/Microsoft/hcsshim/pkg/ncproxy/ncproxygrpc/v1"
"github.com/pkg/errors"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/tools/networkagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"syscall"

"github.com/Microsoft/go-winio/pkg/guid"
"github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc"
"github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc"
"github.com/Microsoft/hcsshim/hcn"
"github.com/Microsoft/hcsshim/internal/log"
ncproxygrpc "github.com/Microsoft/hcsshim/pkg/ncproxy/ncproxygrpc/v1"
nodenetsvc "github.com/Microsoft/hcsshim/pkg/ncproxy/nodenetsvc/v1"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/ncproxy/ncproxygrpc/v1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package v1
Loading

0 comments on commit 2b756cf

Please sign in to comment.