runtime: consolidate types definition

We do not need the vc types translation for network data structures.
Just use the protocol buffer definitions.

Fixes: #415
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao
2020-07-15 14:46:36 +08:00
parent b0e5e12a08
commit 5b15e9ef4f
18 changed files with 171 additions and 362 deletions

View File

@@ -13,7 +13,7 @@ import (
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
@@ -694,7 +694,7 @@ func TestVCMockAddInterface(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.AddInterfaceFunc = func(ctx context.Context, sid string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
m.AddInterfaceFunc = func(ctx context.Context, sid string, inf *pbTypes.Interface) (*pbTypes.Interface, error) {
return nil, nil
}
@@ -721,7 +721,7 @@ func TestVCMockRemoveInterface(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.RemoveInterfaceFunc = func(ctx context.Context, sid string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
m.RemoveInterfaceFunc = func(ctx context.Context, sid string, inf *pbTypes.Interface) (*pbTypes.Interface, error) {
return nil, nil
}
@@ -748,7 +748,7 @@ func TestVCMockListInterfaces(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.ListInterfacesFunc = func(ctx context.Context, sid string) ([]*vcTypes.Interface, error) {
m.ListInterfacesFunc = func(ctx context.Context, sid string) ([]*pbTypes.Interface, error) {
return nil, nil
}
@@ -775,7 +775,7 @@ func TestVCMockUpdateRoutes(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.UpdateRoutesFunc = func(ctx context.Context, sid string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
m.UpdateRoutesFunc = func(ctx context.Context, sid string, routes []*pbTypes.Route) ([]*pbTypes.Route, error) {
return nil, nil
}
@@ -802,7 +802,7 @@ func TestVCMockListRoutes(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.ListRoutesFunc = func(ctx context.Context, sid string) ([]*vcTypes.Route, error) {
m.ListRoutesFunc = func(ctx context.Context, sid string) ([]*pbTypes.Route, error) {
return nil, nil
}