util.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. Copyright 2018 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 testing
  14. import "k8s.io/kubernetes/pkg/kubelet/checkpointmanager"
  15. var _ checkpointmanager.Checkpoint = &MockCheckpoint{}
  16. // MockCheckpoint struct is used for mocking checkpoint values in testing
  17. type MockCheckpoint struct {
  18. Content string
  19. }
  20. // MarshalCheckpoint returns fake content
  21. func (mc *MockCheckpoint) MarshalCheckpoint() ([]byte, error) {
  22. return []byte(mc.Content), nil
  23. }
  24. // UnmarshalCheckpoint fakes unmarshaling
  25. func (mc *MockCheckpoint) UnmarshalCheckpoint(blob []byte) error {
  26. return nil
  27. }
  28. // VerifyChecksum fakes verifying checksum
  29. func (mc *MockCheckpoint) VerifyChecksum() error {
  30. return nil
  31. }