Add initial sandbox management implementation

Signed-off-by: Random-Liu <lantaol@google.com>
This commit is contained in:
Random-Liu
2017-05-12 13:14:11 -07:00
parent 507eff04b3
commit bf28c7fc75
13 changed files with 842 additions and 51 deletions

View File

@@ -17,8 +17,11 @@ limitations under the License.
package testing
import (
"io"
"os"
"golang.org/x/net/context"
osInterface "github.com/kubernetes-incubator/cri-containerd/pkg/os"
)
@@ -28,6 +31,7 @@ import (
type FakeOS struct {
MkdirAllFn func(string, os.FileMode) error
RemoveAllFn func(string) error
OpenFifoFn func(context.Context, string, int, os.FileMode) (io.ReadWriteCloser, error)
}
var _ osInterface.OS = &FakeOS{}
@@ -52,3 +56,11 @@ func (f *FakeOS) RemoveAll(path string) error {
}
return nil
}
// OpenFifo is a fake call that invokes OpenFifoFn or just returns nil.
func (f *FakeOS) OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) {
if f.OpenFifoFn != nil {
return f.OpenFifoFn(ctx, fn, flag, perm)
}
return nil, nil
}