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

Commit

Permalink
containerd-shim-kata: add unit test cases
Browse files Browse the repository at this point in the history
Add unit test cases.

Signed-off-by: fupan <[email protected]>
  • Loading branch information
lifupan committed Nov 22, 2018
1 parent dff3ced commit 96b109b
Show file tree
Hide file tree
Showing 7 changed files with 1,268 additions and 0 deletions.
40 changes: 40 additions & 0 deletions containerd-shim-v2/container_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2018 HyperHQ Inc.
//
// SPDX-License-Identifier: Apache-2.0
//

package containerdshim

import (
taskAPI "github.com/containerd/containerd/runtime/v2/task"
"github.com/stretchr/testify/assert"
"testing"
)

func TestNewContainer(t *testing.T) {
assert := assert.New(t)

_, err := newContainer(nil, nil, "", nil)

assert.Error(err)
}

func TestGetExec(t *testing.T) {
assert := assert.New(t)

r := &taskAPI.CreateTaskRequest{}

c, err := newContainer(nil, r, "", nil)
assert.NoError(err)

_, err = c.getExec("")
assert.Error(err)

c.execs = make(map[string]*exec)
_, err = c.getExec("")
assert.Error(err)

c.execs[TestID] = &exec{}
_, err = c.getExec(TestID)
assert.NoError(err)
}
Loading

0 comments on commit 96b109b

Please sign in to comment.