Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #72 from jodh-intel/fix-lint-errors
Browse files Browse the repository at this point in the history
Fix lint errors & get virtcontainers tests running
  • Loading branch information
Sebastien Boeuf authored Mar 20, 2018
2 parents 4e86f58 + 734c387 commit c8e0c2c
Show file tree
Hide file tree
Showing 52 changed files with 243 additions and 447 deletions.
99 changes: 0 additions & 99 deletions .ci/go-static-checks.sh

This file was deleted.

6 changes: 6 additions & 0 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ clone_tests_repo
pushd "${tests_repo_dir}"
.ci/setup.sh
popd

echo "Setup virtcontainers environment"
chronic sudo -E PATH=$PATH bash -c "${cidir}/../virtcontainers/utils/virtcontainers-setup.sh"

echo "Install virtcontainers"
make -C "${cidir}/../virtcontainers" && chronic sudo make -C "${cidir}/../virtcontainers" install
2 changes: 1 addition & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ check-go-test: $(GENERATED_FILES)
$(QUIET_TEST)$(MAKEFILE_DIR)/../.ci/go-test.sh

check-go-static:
$(QUIET_CHECK)$(MAKEFILE_DIR)/../.ci/go-static-checks.sh $(GO_STATIC_CHECKS_ARGS)
$(QUIET_CHECK)$(MAKEFILE_DIR)/../.ci/static-checks.sh
$(QUIET_CHECK)$(MAKEFILE_DIR)/../.ci/go-no-os-exit.sh

coverage:
Expand Down
44 changes: 22 additions & 22 deletions cli/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -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},
},
}
Expand Down Expand Up @@ -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},
},
}
Expand Down Expand Up @@ -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))
}
}

Expand All @@ -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},
},
}
Expand Down Expand Up @@ -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},
},
}
Expand Down Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -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))
}
}

Expand All @@ -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() {
Expand Down
Loading

0 comments on commit c8e0c2c

Please sign in to comment.