forked from kata-containers/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mockcontainer.go
106 lines (83 loc) · 2.07 KB
/
mockcontainer.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
106
//
// Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package main
import (
"fmt"
"os"
"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runtime-spec/specs-go"
)
type mockContainer struct {
id string
status libcontainer.Status
stats libcontainer.Stats
processes []int
}
func (m *mockContainer) ID() string {
return m.id
}
func (m *mockContainer) Status() (libcontainer.Status, error) {
return m.status, nil
}
func (m *mockContainer) State() (*libcontainer.State, error) {
return nil, nil
}
func (m *mockContainer) OCIState() (*specs.State, error) {
return nil, nil
}
func (m *mockContainer) Config() configs.Config {
return configs.Config{
Capabilities: &configs.Capabilities{},
Cgroups: &configs.Cgroup{
Resources: &configs.Resources{},
Path: fmt.Sprintf("/cgroup/%s", m.id),
},
Seccomp: &configs.Seccomp{},
}
}
func (m *mockContainer) Processes() ([]int, error) {
return m.processes, nil
}
func (m *mockContainer) Stats() (*libcontainer.Stats, error) {
return &m.stats, nil
}
func (m *mockContainer) Set(config configs.Config) error {
return nil
}
func (m *mockContainer) Start(process *libcontainer.Process) (err error) {
return nil
}
func (m *mockContainer) Run(process *libcontainer.Process) (err error) {
return nil
}
func (m *mockContainer) Destroy() error {
return nil
}
func (m *mockContainer) Signal(s os.Signal, all bool) error {
return nil
}
func (m *mockContainer) Exec() error {
return nil
}
func (m *mockContainer) Checkpoint(criuOpts *libcontainer.CriuOpts) error {
return nil
}
func (m *mockContainer) Restore(process *libcontainer.Process, criuOpts *libcontainer.CriuOpts) error {
return nil
}
func (m *mockContainer) Pause() error {
return nil
}
func (m *mockContainer) Resume() error {
return nil
}
func (m *mockContainer) NotifyOOM() (<-chan struct{}, error) {
return nil, nil
}
func (m *mockContainer) NotifyMemoryPressure(level libcontainer.PressureLevel) (<-chan struct{}, error) {
return nil, nil
}