mocks_test.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /*
  2. Copyright 2016 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package stats
  14. import "github.com/stretchr/testify/mock"
  15. import cadvisorapi "github.com/google/cadvisor/info/v1"
  16. import cadvisorapiv2 "github.com/google/cadvisor/info/v2"
  17. import "k8s.io/kubernetes/pkg/api"
  18. import "k8s.io/kubernetes/pkg/kubelet/cm"
  19. import "k8s.io/kubernetes/pkg/types"
  20. import "k8s.io/kubernetes/pkg/volume"
  21. // DO NOT EDIT
  22. // GENERATED BY mockery
  23. type MockStatsProvider struct {
  24. mock.Mock
  25. }
  26. // GetContainerInfo provides a mock function with given fields: podFullName, uid, containerName, req
  27. func (_m *MockStatsProvider) GetContainerInfo(podFullName string, uid types.UID, containerName string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) {
  28. ret := _m.Called(podFullName, uid, containerName, req)
  29. var r0 *cadvisorapi.ContainerInfo
  30. if rf, ok := ret.Get(0).(func(string, types.UID, string, *cadvisorapi.ContainerInfoRequest) *cadvisorapi.ContainerInfo); ok {
  31. r0 = rf(podFullName, uid, containerName, req)
  32. } else {
  33. if ret.Get(0) != nil {
  34. r0 = ret.Get(0).(*cadvisorapi.ContainerInfo)
  35. }
  36. }
  37. var r1 error
  38. if rf, ok := ret.Get(1).(func(string, types.UID, string, *cadvisorapi.ContainerInfoRequest) error); ok {
  39. r1 = rf(podFullName, uid, containerName, req)
  40. } else {
  41. r1 = ret.Error(1)
  42. }
  43. return r0, r1
  44. }
  45. // GetContainerInfoV2 provides a mock function with given fields: name, options
  46. func (_m *MockStatsProvider) GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) {
  47. ret := _m.Called(name, options)
  48. var r0 map[string]cadvisorapiv2.ContainerInfo
  49. if rf, ok := ret.Get(0).(func(string, cadvisorapiv2.RequestOptions) map[string]cadvisorapiv2.ContainerInfo); ok {
  50. r0 = rf(name, options)
  51. } else {
  52. if ret.Get(0) != nil {
  53. r0 = ret.Get(0).(map[string]cadvisorapiv2.ContainerInfo)
  54. }
  55. }
  56. var r1 error
  57. if rf, ok := ret.Get(1).(func(string, cadvisorapiv2.RequestOptions) error); ok {
  58. r1 = rf(name, options)
  59. } else {
  60. r1 = ret.Error(1)
  61. }
  62. return r0, r1
  63. }
  64. // GetRawContainerInfo provides a mock function with given fields: containerName, req, subcontainers
  65. func (_m *MockStatsProvider) GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorapi.ContainerInfo, error) {
  66. ret := _m.Called(containerName, req, subcontainers)
  67. var r0 map[string]*cadvisorapi.ContainerInfo
  68. if rf, ok := ret.Get(0).(func(string, *cadvisorapi.ContainerInfoRequest, bool) map[string]*cadvisorapi.ContainerInfo); ok {
  69. r0 = rf(containerName, req, subcontainers)
  70. } else {
  71. if ret.Get(0) != nil {
  72. r0 = ret.Get(0).(map[string]*cadvisorapi.ContainerInfo)
  73. }
  74. }
  75. var r1 error
  76. if rf, ok := ret.Get(1).(func(string, *cadvisorapi.ContainerInfoRequest, bool) error); ok {
  77. r1 = rf(containerName, req, subcontainers)
  78. } else {
  79. r1 = ret.Error(1)
  80. }
  81. return r0, r1
  82. }
  83. // GetPodByName provides a mock function with given fields: namespace, name
  84. func (_m *MockStatsProvider) GetPodByName(namespace string, name string) (*api.Pod, bool) {
  85. ret := _m.Called(namespace, name)
  86. var r0 *api.Pod
  87. if rf, ok := ret.Get(0).(func(string, string) *api.Pod); ok {
  88. r0 = rf(namespace, name)
  89. } else {
  90. if ret.Get(0) != nil {
  91. r0 = ret.Get(0).(*api.Pod)
  92. }
  93. }
  94. var r1 bool
  95. if rf, ok := ret.Get(1).(func(string, string) bool); ok {
  96. r1 = rf(namespace, name)
  97. } else {
  98. r1 = ret.Get(1).(bool)
  99. }
  100. return r0, r1
  101. }
  102. // GetNode provides a mock function with given fields:
  103. func (_m *MockStatsProvider) GetNode() (*api.Node, error) {
  104. ret := _m.Called()
  105. var r0 *api.Node
  106. if rf, ok := ret.Get(0).(func() *api.Node); ok {
  107. r0 = rf()
  108. } else {
  109. if ret.Get(0) != nil {
  110. r0 = ret.Get(0).(*api.Node)
  111. }
  112. }
  113. var r1 error
  114. if rf, ok := ret.Get(1).(func() error); ok {
  115. r1 = rf()
  116. } else {
  117. r1 = ret.Error(1)
  118. }
  119. return r0, r1
  120. }
  121. // GetNodeConfig provides a mock function with given fields:
  122. func (_m *MockStatsProvider) GetNodeConfig() cm.NodeConfig {
  123. ret := _m.Called()
  124. var r0 cm.NodeConfig
  125. if rf, ok := ret.Get(0).(func() cm.NodeConfig); ok {
  126. r0 = rf()
  127. } else {
  128. r0 = ret.Get(0).(cm.NodeConfig)
  129. }
  130. return r0
  131. }
  132. // ImagesFsInfo provides a mock function with given fields:
  133. func (_m *MockStatsProvider) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) {
  134. ret := _m.Called()
  135. var r0 cadvisorapiv2.FsInfo
  136. if rf, ok := ret.Get(0).(func() cadvisorapiv2.FsInfo); ok {
  137. r0 = rf()
  138. } else {
  139. r0 = ret.Get(0).(cadvisorapiv2.FsInfo)
  140. }
  141. var r1 error
  142. if rf, ok := ret.Get(1).(func() error); ok {
  143. r1 = rf()
  144. } else {
  145. r1 = ret.Error(1)
  146. }
  147. return r0, r1
  148. }
  149. // RootFsInfo provides a mock function with given fields:
  150. func (_m *MockStatsProvider) RootFsInfo() (cadvisorapiv2.FsInfo, error) {
  151. ret := _m.Called()
  152. var r0 cadvisorapiv2.FsInfo
  153. if rf, ok := ret.Get(0).(func() cadvisorapiv2.FsInfo); ok {
  154. r0 = rf()
  155. } else {
  156. r0 = ret.Get(0).(cadvisorapiv2.FsInfo)
  157. }
  158. var r1 error
  159. if rf, ok := ret.Get(1).(func() error); ok {
  160. r1 = rf()
  161. } else {
  162. r1 = ret.Error(1)
  163. }
  164. return r0, r1
  165. }
  166. // ListVolumesForPod provides a mock function with given fields: podUID
  167. func (_m *MockStatsProvider) ListVolumesForPod(podUID types.UID) (map[string]volume.Volume, bool) {
  168. ret := _m.Called(podUID)
  169. var r0 map[string]volume.Volume
  170. if rf, ok := ret.Get(0).(func(types.UID) map[string]volume.Volume); ok {
  171. r0 = rf(podUID)
  172. } else {
  173. if ret.Get(0) != nil {
  174. r0 = ret.Get(0).(map[string]volume.Volume)
  175. }
  176. }
  177. var r1 bool
  178. if rf, ok := ret.Get(1).(func(types.UID) bool); ok {
  179. r1 = rf(podUID)
  180. } else {
  181. r1 = ret.Get(1).(bool)
  182. }
  183. return r0, r1
  184. }
  185. // GetPods provides a mock function with given fields:
  186. func (_m *MockStatsProvider) GetPods() []*api.Pod {
  187. ret := _m.Called()
  188. var r0 []*api.Pod
  189. if rf, ok := ret.Get(0).(func() []*api.Pod); ok {
  190. r0 = rf()
  191. } else {
  192. if ret.Get(0) != nil {
  193. r0 = ret.Get(0).([]*api.Pod)
  194. }
  195. }
  196. return r0
  197. }