/
container_mock.go
105 lines (76 loc) · 2.64 KB
/
container_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright (c) 2022 Fujitsu Limited
package testing
import (
"context"
containerdapi "github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
prototypes "github.com/gogo/protobuf/types"
"github.com/stretchr/testify/mock"
)
type FakeContainerdContainer struct {
mock.Mock
}
func (fcc *FakeContainerdContainer) ID() string {
args := fcc.Called()
return args.Get(0).(string)
}
func (fcc *FakeContainerdContainer) Info(
ctx context.Context, opts ...containerdapi.InfoOpts) (
containers.Container, error) {
args := fcc.Called(ctx, opts)
return args.Get(0).(containers.Container), args.Error(1)
}
func (fcc *FakeContainerdContainer) Delete(
ctx context.Context, opts ...containerdapi.DeleteOpts) error {
args := fcc.Called(ctx, opts)
return args.Error(0)
}
func (fcc *FakeContainerdContainer) NewTask(
ctx context.Context, ioCreate cio.Creator,
opts ...containerdapi.NewTaskOpts) (containerdapi.Task, error) {
args := fcc.Called(ctx, ioCreate, opts)
return args.Get(0).(containerdapi.Task), args.Error(1)
}
func (fcc *FakeContainerdContainer) Spec(
ctx context.Context) (*oci.Spec, error) {
args := fcc.Called(ctx)
return args.Get(0).(*oci.Spec), args.Error(1)
}
func (fcc *FakeContainerdContainer) Task(
ctx context.Context, attach cio.Attach) (containerdapi.Task, error) {
args := fcc.Called(ctx, attach)
return args.Get(0).(containerdapi.Task), args.Error(1)
}
func (fcc *FakeContainerdContainer) Image(
ctx context.Context) (containerdapi.Image, error) {
args := fcc.Called(ctx)
return args.Get(0).(containerdapi.Image), args.Error(1)
}
func (fcc *FakeContainerdContainer) Labels(
ctx context.Context) (map[string]string, error) {
args := fcc.Called(ctx)
return args.Get(0).(map[string]string), args.Error(1)
}
func (fcc *FakeContainerdContainer) SetLabels(
ctx context.Context, labels map[string]string) (map[string]string, error) {
args := fcc.Called(ctx, labels)
return args.Get(0).(map[string]string), args.Error(1)
}
func (fcc *FakeContainerdContainer) Extensions(
ctx context.Context) (map[string]prototypes.Any, error) {
args := fcc.Called(ctx)
return args.Get(0).(map[string]prototypes.Any), args.Error(1)
}
func (fcc *FakeContainerdContainer) Update(
ctx context.Context, opts ...containerdapi.UpdateContainerOpts) error {
args := fcc.Called(ctx, opts)
return args.Error(0)
}
func (fcc *FakeContainerdContainer) Checkpoint(
ctx context.Context, ref string,
opts ...containerdapi.CheckpointOpts) (containerdapi.Image, error) {
args := fcc.Called(ctx, ref, opts)
return args.Get(0).(containerdapi.Image), args.Error(1)
}