lint: Rename vcMock to vcmock

As recommended by `golint`, renamed the `vcMock` package to `vcmock`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2018-03-19 19:35:30 +00:00
parent b1628639e8
commit ce37ac146d
18 changed files with 136 additions and 136 deletions

View File

@ -26,7 +26,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
@ -301,9 +301,9 @@ func TestCreateCLIFunctionCreateFail(t *testing.T) {
func TestCreateInvalidArgs(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
MockContainers: []*vcMock.Container{
MockContainers: []*vcmock.Container{
{MockID: testContainerID},
{MockID: testContainerID},
{MockID: testContainerID},
@ -401,7 +401,7 @@ func TestCreateInvalidConfigJSON(t *testing.T) {
for detach := range []bool{true, false} {
err := create(testContainerID, bundlePath, testConsole, pidFilePath, true, runtimeConfig)
assert.Errorf(err, "%+v", detach)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}
@ -448,7 +448,7 @@ func TestCreateInvalidContainerType(t *testing.T) {
for detach := range []bool{true, false} {
err := create(testContainerID, bundlePath, testConsole, pidFilePath, true, runtimeConfig)
assert.Errorf(err, "%+v", detach)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}
@ -496,16 +496,16 @@ func TestCreateContainerInvalid(t *testing.T) {
for detach := range []bool{true, false} {
err := create(testContainerID, bundlePath, testConsole, pidFilePath, true, runtimeConfig)
assert.Errorf(err, "%+v", detach)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}
func TestCreateProcessCgroupsPathSuccessful(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
MockContainers: []*vcMock.Container{
MockContainers: []*vcmock.Container{
{MockID: testContainerID},
},
}
@ -598,9 +598,9 @@ func TestCreateCreateCgroupsFilesFail(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
MockContainers: []*vcMock.Container{
MockContainers: []*vcmock.Container{
{MockID: testContainerID},
},
}
@ -671,7 +671,7 @@ func TestCreateCreateCgroupsFilesFail(t *testing.T) {
for detach := range []bool{true, false} {
err := create(testContainerID, bundlePath, testConsole, pidFilePath, true, runtimeConfig)
assert.Errorf(err, "%+v", detach)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}
@ -683,9 +683,9 @@ func TestCreateCreateCreatePidFileFail(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
MockContainers: []*vcMock.Container{
MockContainers: []*vcmock.Container{
{MockID: testContainerID},
},
}
@ -747,16 +747,16 @@ func TestCreateCreateCreatePidFileFail(t *testing.T) {
for detach := range []bool{true, false} {
err := create(testContainerID, bundlePath, testConsole, pidFilePath, true, runtimeConfig)
assert.Errorf(err, "%+v", detach)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}
func TestCreate(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
MockContainers: []*vcMock.Container{
MockContainers: []*vcmock.Container{
{MockID: testContainerID},
},
}
@ -873,7 +873,7 @@ func TestCreateInvalidKernelParams(t *testing.T) {
for detach := range []bool{true, false} {
err := create(testContainerID, bundlePath, testConsole, pidFilePath, true, runtimeConfig)
assert.Errorf(err, "%+v", detach)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}
@ -921,7 +921,7 @@ func TestCreateCreatePodPodConfigFail(t *testing.T) {
_, err = createPod(spec, runtimeConfig, testContainerID, bundlePath, testConsole, true)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestCreateCreatePodFail(t *testing.T) {
@ -956,7 +956,7 @@ func TestCreateCreatePodFail(t *testing.T) {
_, err = createPod(spec, runtimeConfig, testContainerID, bundlePath, testConsole, true)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}
func TestCreateCreateContainerContainerConfigFail(t *testing.T) {
@ -998,7 +998,7 @@ func TestCreateCreateContainerContainerConfigFail(t *testing.T) {
for _, disableOutput := range []bool{true, false} {
_, err = createContainer(spec, testContainerID, bundlePath, testConsole, disableOutput)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
assert.True(strings.Contains(err.Error(), containerType))
}
}
@ -1042,7 +1042,7 @@ func TestCreateCreateContainerFail(t *testing.T) {
for _, disableOutput := range []bool{true, false} {
_, err = createContainer(spec, testContainerID, bundlePath, testConsole, disableOutput)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}
}
@ -1055,7 +1055,7 @@ func TestCreateCreateContainer(t *testing.T) {
}
testingImpl.CreateContainerFunc = func(podID string, containerConfig vc.ContainerConfig) (vc.VCPod, vc.VCContainer, error) {
return &vcMock.Pod{}, &vcMock.Container{}, nil
return &vcmock.Pod{}, &vcmock.Container{}, nil
}
defer func() {

View File

@ -23,7 +23,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -61,12 +61,12 @@ func TestDeleteInvalidContainer(t *testing.T) {
// Missing container id
err := delete("", false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
// Mock Listpod error
err = delete(testContainerID, false)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.ListPodFunc = func() ([]vc.PodStatus, error) {
return []vc.PodStatus{}, nil
@ -79,13 +79,13 @@ func TestDeleteInvalidContainer(t *testing.T) {
// Container missing in ListPod
err = delete(testContainerID, false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestDeleteMissingContainerTypeAnnotation(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -109,13 +109,13 @@ func TestDeleteMissingContainerTypeAnnotation(t *testing.T) {
err := delete(pod.ID(), false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestDeleteInvalidConfig(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -141,7 +141,7 @@ func TestDeleteInvalidConfig(t *testing.T) {
err := delete(pod.ID(), false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func testConfigSetup(t *testing.T) string {
@ -165,7 +165,7 @@ func testConfigSetup(t *testing.T) string {
func TestDeletePod(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -199,7 +199,7 @@ func TestDeletePod(t *testing.T) {
err = delete(pod.ID(), false)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.StopPodFunc = func(podID string) (vc.VCPod, error) {
return pod, nil
@ -211,7 +211,7 @@ func TestDeletePod(t *testing.T) {
err = delete(pod.ID(), false)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.DeletePodFunc = func(podID string) (vc.VCPod, error) {
return pod, nil
@ -228,7 +228,7 @@ func TestDeletePod(t *testing.T) {
func TestDeleteInvalidContainerType(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -263,13 +263,13 @@ func TestDeleteInvalidContainerType(t *testing.T) {
// Delete an invalid container type
err = delete(pod.ID(), false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestDeletePodRunning(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -304,7 +304,7 @@ func TestDeletePodRunning(t *testing.T) {
// Delete on a running pod should fail
err = delete(pod.ID(), false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
testingImpl.StopPodFunc = func(podID string) (vc.VCPod, error) {
return pod, nil
@ -317,7 +317,7 @@ func TestDeletePodRunning(t *testing.T) {
// Force delete a running pod
err = delete(pod.ID(), true)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.DeletePodFunc = func(podID string) (vc.VCPod, error) {
return pod, nil
@ -334,11 +334,11 @@ func TestDeletePodRunning(t *testing.T) {
func TestDeleteRunningContainer(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPod: pod,
@ -376,12 +376,12 @@ func TestDeleteRunningContainer(t *testing.T) {
// Delete on a running container should fail.
err = delete(pod.MockContainers[0].ID(), false)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
// force delete
err = delete(pod.MockContainers[0].ID(), true)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.StopContainerFunc = testStopContainerFuncReturnNil
defer func() {
@ -390,10 +390,10 @@ func TestDeleteRunningContainer(t *testing.T) {
err = delete(pod.MockContainers[0].ID(), true)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.DeleteContainerFunc = func(podID, containerID string) (vc.VCContainer, error) {
return &vcMock.Container{}, nil
return &vcmock.Container{}, nil
}
defer func() {
@ -407,11 +407,11 @@ func TestDeleteRunningContainer(t *testing.T) {
func TestDeleteContainer(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPod: pod,
@ -448,7 +448,7 @@ func TestDeleteContainer(t *testing.T) {
err = delete(pod.MockContainers[0].ID(), false)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.StopContainerFunc = testStopContainerFuncReturnNil
defer func() {
@ -457,10 +457,10 @@ func TestDeleteContainer(t *testing.T) {
err = delete(pod.MockContainers[0].ID(), false)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.DeleteContainerFunc = func(podID, containerID string) (vc.VCContainer, error) {
return &vcMock.Container{}, nil
return &vcmock.Container{}, nil
}
defer func() {
@ -485,7 +485,7 @@ func TestDeleteCLIFunction(t *testing.T) {
// no container id in the Metadata
err := fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
flagSet = flag.NewFlagSet("container-id", flag.ContinueOnError)
flagSet.Parse([]string{"xyz"})
@ -493,17 +493,17 @@ func TestDeleteCLIFunction(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}
func TestDeleteCLIFunctionSuccess(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPod: pod,
@ -558,7 +558,7 @@ func TestDeleteCLIFunctionSuccess(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
flagSet = flag.NewFlagSet("container-id", flag.ContinueOnError)
flagSet.Parse([]string{pod.ID()})

View File

@ -25,7 +25,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -43,7 +43,7 @@ func TestExecCLIFunction(t *testing.T) {
// no container-id in the Metadata
err := fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
// pass container-id
flagSet = flag.NewFlagSet("container-id", flag.ContinueOnError)
@ -52,7 +52,7 @@ func TestExecCLIFunction(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}
func TestExecuteErrors(t *testing.T) {
@ -64,13 +64,13 @@ func TestExecuteErrors(t *testing.T) {
// missing container id
err := execute(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
// ListPod error
flagSet.Parse([]string{testContainerID})
err = execute(ctx)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
// Config path missing in annotations
annotations := map[string]string{
@ -87,7 +87,7 @@ func TestExecuteErrors(t *testing.T) {
err = execute(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
// Container not running
configPath := testConfigSetup(t)
@ -109,7 +109,7 @@ func TestExecuteErrors(t *testing.T) {
err = execute(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestExecuteErrorReadingProcessJson(t *testing.T) {
@ -154,7 +154,7 @@ func TestExecuteErrorReadingProcessJson(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestExecuteErrorOpeningConsole(t *testing.T) {
@ -198,7 +198,7 @@ func TestExecuteErrorOpeningConsole(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func testExecParamsSetup(t *testing.T, pidFilePath, consolePath string, detach bool) *flag.FlagSet {
@ -260,10 +260,10 @@ func TestExecuteWithFlags(t *testing.T) {
// EnterContainer error
err = fn(ctx)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.EnterContainerFunc = func(podID, containerID string, cmd vc.Cmd) (vc.VCPod, vc.VCContainer, *vc.Process, error) {
return &vcMock.Pod{}, &vcMock.Container{}, &vc.Process{}, nil
return &vcmock.Pod{}, &vcmock.Container{}, &vc.Process{}, nil
}
defer func() {
@ -274,7 +274,7 @@ func TestExecuteWithFlags(t *testing.T) {
// Process not running error
err = fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
os.Remove(pidFilePath)
@ -288,7 +288,7 @@ func TestExecuteWithFlags(t *testing.T) {
vcProcess := vc.Process{}
vcProcess.Pid = command.Process.Pid
return &vcMock.Pod{}, &vcMock.Container{}, &vcProcess, nil
return &vcmock.Pod{}, &vcmock.Container{}, &vcProcess, nil
}
defer func() {
@ -347,7 +347,7 @@ func TestExecuteWithFlagsDetached(t *testing.T) {
vcProcess := vc.Process{}
vcProcess.Pid = command.Process.Pid
return &vcMock.Pod{}, &vcMock.Container{}, &vcProcess, nil
return &vcmock.Pod{}, &vcmock.Container{}, &vcProcess, nil
}
defer func() {
@ -417,7 +417,7 @@ func TestExecuteWithInvalidProcessJson(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestExecuteWithValidProcessJson(t *testing.T) {
@ -499,7 +499,7 @@ func TestExecuteWithValidProcessJson(t *testing.T) {
vcProcess := vc.Process{}
vcProcess.Pid = command.Process.Pid
return &vcMock.Pod{}, &vcMock.Container{}, &vcProcess, nil
return &vcmock.Pod{}, &vcmock.Container{}, &vcProcess, nil
}
defer func() {
@ -572,7 +572,7 @@ func TestExecuteWithInvalidEnvironment(t *testing.T) {
// vcAnnotations.EnvVars error due to incorrect environment
err = fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestGenerateExecParams(t *testing.T) {

View File

@ -21,7 +21,7 @@ import (
"testing"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
)
@ -31,7 +31,7 @@ var (
}
testStopContainerFuncReturnNil = func(podID, containerID string) (vc.VCContainer, error) {
return &vcMock.Container{}, nil
return &vcmock.Container{}, nil
}
)

View File

@ -28,7 +28,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -395,7 +395,7 @@ func TestListGetContainersListPodFail(t *testing.T) {
_, err = getContainers(ctx)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}
func TestListGetContainers(t *testing.T) {
@ -433,7 +433,7 @@ func TestListGetContainers(t *testing.T) {
func TestListGetContainersPodWithoutContainers(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -477,7 +477,7 @@ func TestListGetContainersPodWithContainer(t *testing.T) {
assert.NoError(err)
defer os.RemoveAll(tmpdir)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -550,7 +550,7 @@ func TestListCLIFunctionFormatFail(t *testing.T) {
{"invalid", invalidFlags},
}
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -621,7 +621,7 @@ func TestListCLIFunctionFormatFail(t *testing.T) {
// invalid output file
assert.Error(err, d)
assert.False(vcMock.IsMockError(err), d)
assert.False(vcmock.IsMockError(err), d)
output := filepath.Join(tmpdir, "output")
f, err := os.OpenFile(output, os.O_WRONLY|os.O_CREATE, testFileMode)
@ -634,7 +634,7 @@ func TestListCLIFunctionFormatFail(t *testing.T) {
err = fn(ctx)
if d.format == "invalid" {
assert.Error(err)
assert.False(vcMock.IsMockError(err), d)
assert.False(vcmock.IsMockError(err), d)
} else {
assert.NoError(err)
}
@ -651,7 +651,7 @@ func TestListCLIFunctionQuiet(t *testing.T) {
runtimeConfig, err := newTestRuntimeConfig(tmpdir, testConsole, true)
assert.NoError(err)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}

View File

@ -34,7 +34,7 @@ import (
"github.com/dlespiau/covertool/pkg/cover"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
@ -62,7 +62,7 @@ var (
)
// testingImpl is a concrete mock RVC implementation used for testing
var testingImpl = &vcMock.VCMock{}
var testingImpl = &vcmock.VCMock{}
func init() {
if version == "" {

View File

@ -29,7 +29,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/opencontainers/runc/libcontainer/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
@ -83,7 +83,7 @@ func TestGetContainerInfoContainerIDEmptyFailure(t *testing.T) {
func TestGetContainerInfo(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -118,7 +118,7 @@ func TestGetContainerInfo(t *testing.T) {
func TestGetContainerInfoMismatch(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -154,7 +154,7 @@ func TestValidCreateParamsContainerIDEmptyFailure(t *testing.T) {
_, err := validCreateParams("", "")
assert.Error(err, "This test should fail because containerID is empty")
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestGetExistingContainerInfoContainerIDEmptyFailure(t *testing.T) {
@ -170,7 +170,7 @@ func TestValidCreateParamsContainerIDNotUnique(t *testing.T) {
containerID := testContainerID + testContainerID
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -204,7 +204,7 @@ func TestValidCreateParamsContainerIDNotUnique(t *testing.T) {
_, err := validCreateParams(testContainerID, "")
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestValidCreateParamsContainerIDNotUnique2(t *testing.T) {
@ -212,7 +212,7 @@ func TestValidCreateParamsContainerIDNotUnique2(t *testing.T) {
containerID := testContainerID + testContainerID
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -238,7 +238,7 @@ func TestValidCreateParamsContainerIDNotUnique2(t *testing.T) {
_, err := validCreateParams(testContainerID, "")
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestValidCreateParamsInvalidBundle(t *testing.T) {
@ -261,7 +261,7 @@ func TestValidCreateParamsInvalidBundle(t *testing.T) {
_, err = validCreateParams(testContainerID, bundlePath)
// bundle is ENOENT
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestValidCreateParamsBundleIsAFile(t *testing.T) {
@ -286,7 +286,7 @@ func TestValidCreateParamsBundleIsAFile(t *testing.T) {
_, err = validCreateParams(testContainerID, bundlePath)
// bundle exists as a file, not a directory
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func testProcessCgroupsPath(t *testing.T, ociSpec oci.CompatOCISpec, expected []string) {
@ -565,7 +565,7 @@ func TestProcessCgroupsPathForResource(t *testing.T) {
for _, isPod := range []bool{true, false} {
_, err := processCgroupsPathForResource(spec, "", isPod)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
}

View File

@ -19,17 +19,17 @@ import (
"testing"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
)
var (
testPausePodFuncReturnNil = func(podID string) (vc.VCPod, error) {
return &vcMock.Pod{}, nil
return &vcmock.Pod{}, nil
}
testResumePodFuncReturnNil = func(podID string) (vc.VCPod, error) {
return &vcMock.Pod{}, nil
return &vcmock.Pod{}, nil
}
)

View File

@ -20,7 +20,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -45,11 +45,11 @@ func TestPSCLIAction(t *testing.T) {
func TestPSFailure(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testContainerID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: pod.ID(),
MockPod: pod,
@ -89,11 +89,11 @@ func TestPSFailure(t *testing.T) {
func TestPSSuccessful(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testContainerID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: pod.ID(),
MockPod: pod,

View File

@ -26,7 +26,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -67,9 +67,9 @@ func TestRunCliAction(t *testing.T) {
func TestRunInvalidArgs(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
MockContainers: []*vcMock.Container{
MockContainers: []*vcmock.Container{
{MockID: testContainerID},
},
}
@ -161,7 +161,7 @@ type runContainerData struct {
consolePath string
bundlePath string
configJSON string
pod *vcMock.Pod
pod *vcmock.Pod
runtimeConfig oci.RuntimeConfig
process *os.Process
tmpDir string
@ -196,11 +196,11 @@ func testRunContainerSetup(t *testing.T) runContainerData {
configPath := filepath.Join(bundlePath, specConfig)
// pod id and container id must be the same otherwise delete will not works
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testContainerID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPid: cmd.Process.Pid,
@ -599,11 +599,11 @@ func TestRunContainerStartFailNoContainers(t *testing.T) {
d := testRunContainerSetup(t)
defer os.RemoveAll(d.tmpDir)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPod: pod,
@ -651,5 +651,5 @@ func TestRunContainerStartFailNoContainers(t *testing.T) {
err := run(d.pod.ID(), d.bundlePath, d.consolePath, "", d.pidFilePath, false, d.runtimeConfig)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}

View File

@ -20,7 +20,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -31,12 +31,12 @@ func TestStartInvalidArgs(t *testing.T) {
// Missing container id
_, err := start("")
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
// Mock Listpod error
_, err = start(testContainerID)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.ListPodFunc = func() ([]vc.PodStatus, error) {
return []vc.PodStatus{}, nil
@ -49,13 +49,13 @@ func TestStartInvalidArgs(t *testing.T) {
// Container missing in ListPod
_, err = start(testContainerID)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestStartPod(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -81,7 +81,7 @@ func TestStartPod(t *testing.T) {
_, err := start(pod.ID())
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.StartPodFunc = func(podID string) (vc.VCPod, error) {
return pod, nil
@ -98,7 +98,7 @@ func TestStartPod(t *testing.T) {
func TestStartMissingAnnotation(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
@ -122,17 +122,17 @@ func TestStartMissingAnnotation(t *testing.T) {
_, err := start(pod.ID())
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
}
func TestStartContainerSucessFailure(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPod: pod,
@ -161,7 +161,7 @@ func TestStartContainerSucessFailure(t *testing.T) {
_, err := start(testContainerID)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
testingImpl.StartContainerFunc = func(podID, containerID string) (vc.VCContainer, error) {
return pod.MockContainers[0], nil
@ -189,7 +189,7 @@ func TestStartCLIFunction(t *testing.T) {
// no container id in the Metadata
err := fn(ctx)
assert.Error(err)
assert.False(vcMock.IsMockError(err))
assert.False(vcmock.IsMockError(err))
flagSet = flag.NewFlagSet("container-id", flag.ContinueOnError)
flagSet.Parse([]string{"xyz"})
@ -197,17 +197,17 @@ func TestStartCLIFunction(t *testing.T) {
err = fn(ctx)
assert.Error(err)
assert.True(vcMock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}
func TestStartCLIFunctionSuccess(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testPodID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: testContainerID,
MockPod: pod,

View File

@ -20,7 +20,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcMock"
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
@ -49,11 +49,11 @@ func TestStateCliAction(t *testing.T) {
func TestStateSuccessful(t *testing.T) {
assert := assert.New(t)
pod := &vcMock.Pod{
pod := &vcmock.Pod{
MockID: testContainerID,
}
pod.MockContainers = []*vcMock.Container{
pod.MockContainers = []*vcmock.Container{
{
MockID: pod.ID(),
MockPod: pod,

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package vcMock
package vcmock
import (
vc "github.com/kata-containers/runtime/virtcontainers"

View File

@ -22,7 +22,7 @@
// well-known format. Callers can detect this scenario by calling
// IsMockError().
package vcMock
package vcmock
import (
"fmt"
@ -34,7 +34,7 @@ import (
// mockErrorPrefix is a string that all errors returned by the mock
// implementation itself will contain as a prefix.
const mockErrorPrefix = "vcMock forced failure"
const mockErrorPrefix = "vcmock forced failure"
// SetLogger implements the VC function of the same name.
func (m *VCMock) SetLogger(logger logrus.FieldLogger) {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package vcMock
package vcmock
import (
"reflect"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package vcMock
package vcmock
import (
vc "github.com/kata-containers/runtime/virtcontainers"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package vcMock
package vcmock
import (
"syscall"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package vcMock
package vcmock
import (
"runtime"