forked from barak/tarpoon
Add glide.yaml and vendor deps
This commit is contained in:
parent
db918f12ad
commit
5b3d5e81bd
18880 changed files with 5166045 additions and 1 deletions
33
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/BUILD
generated
vendored
Normal file
33
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/BUILD
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
"go_test",
|
||||
"cgo_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"fake_cache.go",
|
||||
"fake_runtime.go",
|
||||
"mockfileinfo.go",
|
||||
"os.go",
|
||||
"runtime_mock.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/kubelet/container:go_default_library",
|
||||
"//pkg/types:go_default_library",
|
||||
"//pkg/util/flowcontrol:go_default_library",
|
||||
"//pkg/util/term:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
"//vendor:github.com/golang/mock/gomock",
|
||||
"//vendor:github.com/stretchr/testify/mock",
|
||||
],
|
||||
)
|
||||
49
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/fake_cache.go
generated
vendored
Normal file
49
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/fake_cache.go
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
)
|
||||
|
||||
type fakeCache struct {
|
||||
runtime container.Runtime
|
||||
}
|
||||
|
||||
func NewFakeCache(runtime container.Runtime) container.Cache {
|
||||
return &fakeCache{runtime: runtime}
|
||||
}
|
||||
|
||||
func (c *fakeCache) Get(id types.UID) (*container.PodStatus, error) {
|
||||
return c.runtime.GetPodStatus(id, "", "")
|
||||
}
|
||||
|
||||
func (c *fakeCache) GetNewerThan(id types.UID, minTime time.Time) (*container.PodStatus, error) {
|
||||
return c.Get(id)
|
||||
}
|
||||
|
||||
func (c *fakeCache) Set(id types.UID, status *container.PodStatus, err error, timestamp time.Time) {
|
||||
}
|
||||
|
||||
func (c *fakeCache) Delete(id types.UID) {
|
||||
}
|
||||
|
||||
func (c *fakeCache) UpdateTime(_ time.Time) {
|
||||
}
|
||||
500
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/fake_runtime.go
generated
vendored
Normal file
500
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/fake_runtime.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
109
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/mockfileinfo.go
generated
vendored
Normal file
109
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/mockfileinfo.go
generated
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Generated via: mockgen os FileInfo
|
||||
// Edited to include required boilerplate
|
||||
// Source: os (interfaces: FileInfo)
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
os "os"
|
||||
time "time"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
// Mock of FileInfo interface
|
||||
type MockFileInfo struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *_MockFileInfoRecorder
|
||||
}
|
||||
|
||||
// Recorder for MockFileInfo (not exported)
|
||||
type _MockFileInfoRecorder struct {
|
||||
mock *MockFileInfo
|
||||
}
|
||||
|
||||
func NewMockFileInfo(ctrl *gomock.Controller) *MockFileInfo {
|
||||
mock := &MockFileInfo{ctrl: ctrl}
|
||||
mock.recorder = &_MockFileInfoRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) EXPECT() *_MockFileInfoRecorder {
|
||||
return _m.recorder
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) IsDir() bool {
|
||||
ret := _m.ctrl.Call(_m, "IsDir")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockFileInfoRecorder) IsDir() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "IsDir")
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) ModTime() time.Time {
|
||||
ret := _m.ctrl.Call(_m, "ModTime")
|
||||
ret0, _ := ret[0].(time.Time)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockFileInfoRecorder) ModTime() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "ModTime")
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) Mode() os.FileMode {
|
||||
ret := _m.ctrl.Call(_m, "Mode")
|
||||
ret0, _ := ret[0].(os.FileMode)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockFileInfoRecorder) Mode() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Mode")
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) Name() string {
|
||||
ret := _m.ctrl.Call(_m, "Name")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockFileInfoRecorder) Name() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Name")
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) Size() int64 {
|
||||
ret := _m.ctrl.Call(_m, "Size")
|
||||
ret0, _ := ret[0].(int64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockFileInfoRecorder) Size() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Size")
|
||||
}
|
||||
|
||||
func (_m *MockFileInfo) Sys() interface{} {
|
||||
ret := _m.ctrl.Call(_m, "Sys")
|
||||
ret0, _ := ret[0].(interface{})
|
||||
return ret0
|
||||
}
|
||||
|
||||
func (_mr *_MockFileInfoRecorder) Sys() *gomock.Call {
|
||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "Sys")
|
||||
}
|
||||
112
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/os.go
generated
vendored
Normal file
112
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/os.go
generated
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// FakeOS mocks out certain OS calls to avoid perturbing the filesystem
|
||||
// If a member of the form `*Fn` is set, that function will be called in place
|
||||
// of the real call.
|
||||
type FakeOS struct {
|
||||
StatFn func(string) (os.FileInfo, error)
|
||||
ReadDirFn func(string) ([]os.FileInfo, error)
|
||||
MkdirAllFn func(string, os.FileMode) error
|
||||
SymlinkFn func(string, string) error
|
||||
HostName string
|
||||
Removes []string
|
||||
Files map[string][]*os.FileInfo
|
||||
}
|
||||
|
||||
func NewFakeOS() *FakeOS {
|
||||
return &FakeOS{
|
||||
Removes: []string{},
|
||||
Files: make(map[string][]*os.FileInfo),
|
||||
}
|
||||
}
|
||||
|
||||
// Mkdir is a fake call that just returns nil.
|
||||
func (f *FakeOS) MkdirAll(path string, perm os.FileMode) error {
|
||||
if f.MkdirAllFn != nil {
|
||||
return f.MkdirAllFn(path, perm)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Symlink is a fake call that just returns nil.
|
||||
func (f *FakeOS) Symlink(oldname string, newname string) error {
|
||||
if f.SymlinkFn != nil {
|
||||
return f.SymlinkFn(oldname, newname)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stat is a fake that returns an error
|
||||
func (f FakeOS) Stat(path string) (os.FileInfo, error) {
|
||||
if f.StatFn != nil {
|
||||
return f.StatFn(path)
|
||||
}
|
||||
return nil, errors.New("unimplemented testing mock")
|
||||
}
|
||||
|
||||
// Remove is a fake call that returns nil.
|
||||
func (f *FakeOS) Remove(path string) error {
|
||||
f.Removes = append(f.Removes, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveAll is a fake call that just returns nil.
|
||||
func (f *FakeOS) RemoveAll(path string) error {
|
||||
f.Removes = append(f.Removes, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Create is a fake call that returns nil.
|
||||
func (FakeOS) Create(path string) (*os.File, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Hostname is a fake call that returns nil.
|
||||
func (f *FakeOS) Hostname() (name string, err error) {
|
||||
return f.HostName, nil
|
||||
}
|
||||
|
||||
// Chtimes is a fake call that returns nil.
|
||||
func (FakeOS) Chtimes(path string, atime time.Time, mtime time.Time) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Pipe is a fake call that returns nil.
|
||||
func (FakeOS) Pipe() (r *os.File, w *os.File, err error) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// ReadDir is a fake call that returns the files under the directory.
|
||||
func (f *FakeOS) ReadDir(dirname string) ([]os.FileInfo, error) {
|
||||
if f.ReadDirFn != nil {
|
||||
return f.ReadDirFn(dirname)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Glob is a fake call that returns nil.
|
||||
func (f *FakeOS) Glob(pattern string) ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
161
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/runtime_mock.go
generated
vendored
Normal file
161
vendor/k8s.io/kubernetes/pkg/kubelet/container/testing/runtime_mock.go
generated
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
. "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/util/flowcontrol"
|
||||
"k8s.io/kubernetes/pkg/util/term"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
)
|
||||
|
||||
type Mock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
var _ Runtime = new(Mock)
|
||||
|
||||
func (r *Mock) Start() error {
|
||||
args := r.Called()
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) Type() string {
|
||||
args := r.Called()
|
||||
return args.Get(0).(string)
|
||||
}
|
||||
|
||||
func (r *Mock) Version() (Version, error) {
|
||||
args := r.Called()
|
||||
return args.Get(0).(Version), args.Error(1)
|
||||
}
|
||||
|
||||
func (r *Mock) APIVersion() (Version, error) {
|
||||
args := r.Called()
|
||||
return args.Get(0).(Version), args.Error(1)
|
||||
}
|
||||
|
||||
func (r *Mock) Status() (*RuntimeStatus, error) {
|
||||
args := r.Called()
|
||||
return args.Get(0).(*RuntimeStatus), args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) GetPods(all bool) ([]*Pod, error) {
|
||||
args := r.Called(all)
|
||||
return args.Get(0).([]*Pod), args.Error(1)
|
||||
}
|
||||
|
||||
func (r *Mock) SyncPod(pod *v1.Pod, apiStatus v1.PodStatus, status *PodStatus, secrets []v1.Secret, backOff *flowcontrol.Backoff) PodSyncResult {
|
||||
args := r.Called(pod, apiStatus, status, secrets, backOff)
|
||||
return args.Get(0).(PodSyncResult)
|
||||
}
|
||||
|
||||
func (r *Mock) KillPod(pod *v1.Pod, runningPod Pod, gracePeriodOverride *int64) error {
|
||||
args := r.Called(pod, runningPod, gracePeriodOverride)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) RunContainerInPod(container v1.Container, pod *v1.Pod, volumeMap map[string]volume.VolumePlugin) error {
|
||||
args := r.Called(pod, pod, volumeMap)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) KillContainerInPod(container v1.Container, pod *v1.Pod) error {
|
||||
args := r.Called(pod, pod)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) GetPodStatus(uid types.UID, name, namespace string) (*PodStatus, error) {
|
||||
args := r.Called(uid, name, namespace)
|
||||
return args.Get(0).(*PodStatus), args.Error(1)
|
||||
}
|
||||
|
||||
func (r *Mock) ExecInContainer(containerID ContainerID, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size, timeout time.Duration) error {
|
||||
args := r.Called(containerID, cmd, stdin, stdout, stderr, tty)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) AttachContainer(containerID ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) error {
|
||||
args := r.Called(containerID, stdin, stdout, stderr, tty)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) GetContainerLogs(pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error) {
|
||||
args := r.Called(pod, containerID, logOptions, stdout, stderr)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) PullImage(image ImageSpec, pullSecrets []v1.Secret) error {
|
||||
args := r.Called(image, pullSecrets)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) IsImagePresent(image ImageSpec) (bool, error) {
|
||||
args := r.Called(image)
|
||||
return args.Get(0).(bool), args.Error(1)
|
||||
}
|
||||
|
||||
func (r *Mock) ListImages() ([]Image, error) {
|
||||
args := r.Called()
|
||||
return args.Get(0).([]Image), args.Error(1)
|
||||
}
|
||||
|
||||
func (r *Mock) RemoveImage(image ImageSpec) error {
|
||||
args := r.Called(image)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) PortForward(pod *Pod, port uint16, stream io.ReadWriteCloser) error {
|
||||
args := r.Called(pod, port, stream)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) GetNetNS(containerID ContainerID) (string, error) {
|
||||
args := r.Called(containerID)
|
||||
return "", args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) GetPodContainerID(pod *Pod) (ContainerID, error) {
|
||||
args := r.Called(pod)
|
||||
return ContainerID{}, args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) GarbageCollect(gcPolicy ContainerGCPolicy, ready bool) error {
|
||||
args := r.Called(gcPolicy, ready)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) DeleteContainer(containerID ContainerID) error {
|
||||
args := r.Called(containerID)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (r *Mock) ImageStats() (*ImageStats, error) {
|
||||
args := r.Called()
|
||||
return args.Get(0).(*ImageStats), args.Error(1)
|
||||
}
|
||||
|
||||
// UpdatePodCIDR fulfills the cri interface.
|
||||
func (r *Mock) UpdatePodCIDR(c string) error {
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue