Documentation ¶
Overview ¶
Copyright 2018 the Heptio Ark contributors.
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.
Copyright 2018 the Heptio Ark contributors.
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.
Copyright 2018 the Heptio Ark contributors.
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.
Index ¶
- func AssertDeepEqual(t *testing.T, expected, actual interface{}) bool
- func AssertErrorMatches(t *testing.T, expected string, actual error) bool
- func CompareActions(t *testing.T, expected, actual []core.Action)
- func GetAsMap(j string) (map[string]interface{}, error)
- func NewLogger() logrus.FieldLogger
- func TimesAreEqual(t1, t2 time.Time) bool
- func UnstructuredOrDie(data string) *unstructured.Unstructured
- func ValidatePatch(t *testing.T, action core.Action, expected interface{}, ...)
- type FakeBlockStore
- func (bs *FakeBlockStore) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error)
- func (bs *FakeBlockStore) CreateVolumeFromSnapshot(snapshotID, volumeType, volumeAZ string, iops *int64) (string, error)
- func (bs *FakeBlockStore) DeleteSnapshot(snapshotID string) error
- func (bs *FakeBlockStore) GetVolumeID(pv runtime.Unstructured) (string, error)
- func (bs *FakeBlockStore) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error)
- func (bs *FakeBlockStore) Init(config map[string]string) error
- func (bs *FakeBlockStore) SetVolumeID(pv runtime.Unstructured, volumeID string) (runtime.Unstructured, error)
- type FakeDiscoveryHelper
- func (dh *FakeDiscoveryHelper) APIGroups() []metav1.APIGroup
- func (dh *FakeDiscoveryHelper) Refresh() error
- func (dh *FakeDiscoveryHelper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, metav1.APIResource, error)
- func (dh *FakeDiscoveryHelper) Resources() []*metav1.APIResourceList
- type FakeDynamicClient
- func (c *FakeDynamicClient) Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func (c *FakeDynamicClient) Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)
- func (c *FakeDynamicClient) List(options metav1.ListOptions) (runtime.Object, error)
- func (c *FakeDynamicClient) Patch(name string, data []byte) (*unstructured.Unstructured, error)
- func (c *FakeDynamicClient) Watch(options metav1.ListOptions) (watch.Interface, error)
- type FakeDynamicFactory
- type FakeFileSystem
- func (fs *FakeFileSystem) Create(name string) (io.WriteCloser, error)
- func (fs *FakeFileSystem) DirExists(path string) (bool, error)
- func (fs *FakeFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (fs *FakeFileSystem) ReadDir(dirname string) ([]os.FileInfo, error)
- func (fs *FakeFileSystem) ReadFile(filename string) ([]byte, error)
- func (fs *FakeFileSystem) RemoveAll(path string) error
- func (fs *FakeFileSystem) Stat(path string) (os.FileInfo, error)
- func (fs *FakeFileSystem) TempDir(dir, prefix string) (string, error)
- func (fs *FakeFileSystem) TempFile(dir, prefix string) (filesystem.NameWriteCloser, error)
- func (fs *FakeFileSystem) WithDirectories(path ...string) *FakeFileSystem
- func (fs *FakeFileSystem) WithDirectory(path string) *FakeFileSystem
- func (fs *FakeFileSystem) WithFile(path string, data []byte) *FakeFileSystem
- func (fs *FakeFileSystem) WithFileAndMode(path string, data []byte, mode os.FileMode) *FakeFileSystem
- type FakeMapper
- type LocationInfo
- type MockPodCommandExecutor
- type TestBackup
- func (b *TestBackup) WithDeletionTimestamp(time time.Time) *TestBackup
- func (b *TestBackup) WithExcludedNamespaces(ns ...string) *TestBackup
- func (b *TestBackup) WithExcludedResources(r ...string) *TestBackup
- func (b *TestBackup) WithExpiration(expiration time.Time) *TestBackup
- func (b *TestBackup) WithFinalizers(finalizers ...string) *TestBackup
- func (b *TestBackup) WithIncludedNamespaces(ns ...string) *TestBackup
- func (b *TestBackup) WithIncludedResources(r ...string) *TestBackup
- func (b *TestBackup) WithLabel(key, value string) *TestBackup
- func (b *TestBackup) WithName(name string) *TestBackup
- func (b *TestBackup) WithNamespace(namespace string) *TestBackup
- func (b *TestBackup) WithPhase(phase v1.BackupPhase) *TestBackup
- func (b *TestBackup) WithResourceVersion(version string) *TestBackup
- func (b *TestBackup) WithSnapshot(pv string, snapshot string) *TestBackup
- func (b *TestBackup) WithSnapshotVolumes(value bool) *TestBackup
- func (b *TestBackup) WithSnapshotVolumesPointer(value *bool) *TestBackup
- func (b *TestBackup) WithStartTimestamp(startTime time.Time) *TestBackup
- func (b *TestBackup) WithStorageLocation(location string) *TestBackup
- func (b *TestBackup) WithTTL(ttl time.Duration) *TestBackup
- func (b *TestBackup) WithVersion(version int) *TestBackup
- func (b *TestBackup) WithVolumeBackupInfo(pv, snapshotID, volumeType, az string, iops *int64) *TestBackup
- func (b *TestBackup) WithVolumeSnapshotLocations(locations ...string) *TestBackup
- type TestBackupStorageLocation
- func (b *TestBackupStorageLocation) WithLabel(key, value string) *TestBackupStorageLocation
- func (b *TestBackupStorageLocation) WithName(name string) *TestBackupStorageLocation
- func (b *TestBackupStorageLocation) WithNamespace(namespace string) *TestBackupStorageLocation
- func (b *TestBackupStorageLocation) WithObjectStorage(bucketName string) *TestBackupStorageLocation
- func (b *TestBackupStorageLocation) WithProvider(name string) *TestBackupStorageLocation
- type TestRestore
- func (r *TestRestore) WithBackup(name string) *TestRestore
- func (r *TestRestore) WithErrors(i int) *TestRestore
- func (r *TestRestore) WithExcludedNamespace(name string) *TestRestore
- func (r *TestRestore) WithExcludedResource(resource string) *TestRestore
- func (r *TestRestore) WithIncludedNamespace(name string) *TestRestore
- func (r *TestRestore) WithIncludedResource(resource string) *TestRestore
- func (r *TestRestore) WithMappedNamespace(from string, to string) *TestRestore
- func (r *TestRestore) WithRestorePVs(value bool) *TestRestore
- func (r *TestRestore) WithSchedule(name string) *TestRestore
- func (r *TestRestore) WithValidationError(err string) *TestRestore
- type TestSchedule
- type TestVolumeSnapshotLocation
- func (location *TestVolumeSnapshotLocation) WithName(name string) *TestVolumeSnapshotLocation
- func (location *TestVolumeSnapshotLocation) WithProvider(name string) *TestVolumeSnapshotLocation
- func (location *TestVolumeSnapshotLocation) WithProviderConfig(info []LocationInfo) []*TestVolumeSnapshotLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDeepEqual ¶
AssertDeepEqual asserts the semantic equality of objects. This function exists in order to make sure time.Time and metav1.Time objects can be compared correctly. See https://github.com/stretchr/testify/issues/502.
func AssertErrorMatches ¶
AssertErrorMatches asserts that if expected is the empty string, actual is nil, otherwise, that actual's error string matches expected.
func CompareActions ¶
CompareActions checks slices of actual and expected Actions for equality (ignoring order). It checks that the lengths of the slices are the same, that each actual Action has a corresponding expected Action, and that each expected Action has a corresponding actual Action.
func NewLogger ¶
func NewLogger() logrus.FieldLogger
func TimesAreEqual ¶
TimesAreEqual compares two times for equality. This function is used by equality.Semantic.DeepEqual to compare two time objects without having to call a method.
func UnstructuredOrDie ¶
func UnstructuredOrDie(data string) *unstructured.Unstructured
func ValidatePatch ¶
func ValidatePatch(t *testing.T, action core.Action, expected interface{}, decodeFunc func(*json.Decoder) (interface{}, error))
ValidatePatch tests the validity of an action. It checks that the action is a PatchAction, that the patch decodes from JSON with the provided decode func and has no extraneous fields, and that the decoded patch matches the expected.
Types ¶
type FakeBlockStore ¶
type FakeBlockStore struct { // SnapshotID->VolumeID SnapshotsTaken sets.String // VolumeID -> (SnapshotID, Type, Iops) SnapshottableVolumes map[string]api.VolumeBackupInfo // VolumeBackupInfo -> VolumeID RestorableVolumes map[api.VolumeBackupInfo]string VolumeID string VolumeIDSet string Error error }
func (*FakeBlockStore) CreateSnapshot ¶
func (*FakeBlockStore) CreateVolumeFromSnapshot ¶
func (bs *FakeBlockStore) CreateVolumeFromSnapshot(snapshotID, volumeType, volumeAZ string, iops *int64) (string, error)
func (*FakeBlockStore) DeleteSnapshot ¶
func (bs *FakeBlockStore) DeleteSnapshot(snapshotID string) error
func (*FakeBlockStore) GetVolumeID ¶
func (bs *FakeBlockStore) GetVolumeID(pv runtime.Unstructured) (string, error)
func (*FakeBlockStore) GetVolumeInfo ¶
func (bs *FakeBlockStore) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error)
func (*FakeBlockStore) SetVolumeID ¶
func (bs *FakeBlockStore) SetVolumeID(pv runtime.Unstructured, volumeID string) (runtime.Unstructured, error)
type FakeDiscoveryHelper ¶
type FakeDiscoveryHelper struct { ResourceList []*metav1.APIResourceList Mapper meta.RESTMapper AutoReturnResource bool APIGroupsList []metav1.APIGroup }
func NewFakeDiscoveryHelper ¶
func NewFakeDiscoveryHelper(autoReturnResource bool, resources map[schema.GroupVersionResource]schema.GroupVersionResource) *FakeDiscoveryHelper
func (*FakeDiscoveryHelper) APIGroups ¶
func (dh *FakeDiscoveryHelper) APIGroups() []metav1.APIGroup
func (*FakeDiscoveryHelper) Refresh ¶
func (dh *FakeDiscoveryHelper) Refresh() error
func (*FakeDiscoveryHelper) ResourceFor ¶
func (dh *FakeDiscoveryHelper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, metav1.APIResource, error)
func (*FakeDiscoveryHelper) Resources ¶
func (dh *FakeDiscoveryHelper) Resources() []*metav1.APIResourceList
type FakeDynamicClient ¶
func (*FakeDynamicClient) Create ¶
func (c *FakeDynamicClient) Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
func (*FakeDynamicClient) Get ¶
func (c *FakeDynamicClient) Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)
func (*FakeDynamicClient) List ¶
func (c *FakeDynamicClient) List(options metav1.ListOptions) (runtime.Object, error)
func (*FakeDynamicClient) Patch ¶
func (c *FakeDynamicClient) Patch(name string, data []byte) (*unstructured.Unstructured, error)
func (*FakeDynamicClient) Watch ¶
func (c *FakeDynamicClient) Watch(options metav1.ListOptions) (watch.Interface, error)
type FakeDynamicFactory ¶
func (*FakeDynamicFactory) ClientForGroupVersionResource ¶
func (df *FakeDynamicFactory) ClientForGroupVersionResource(gv schema.GroupVersion, resource metav1.APIResource, namespace string) (client.Dynamic, error)
type FakeFileSystem ¶
type FakeFileSystem struct { ReadDirCalls []string // contains filtered or unexported fields }
func NewFakeFileSystem ¶
func NewFakeFileSystem() *FakeFileSystem
func (*FakeFileSystem) Create ¶
func (fs *FakeFileSystem) Create(name string) (io.WriteCloser, error)
func (*FakeFileSystem) MkdirAll ¶
func (fs *FakeFileSystem) MkdirAll(path string, perm os.FileMode) error
func (*FakeFileSystem) ReadDir ¶
func (fs *FakeFileSystem) ReadDir(dirname string) ([]os.FileInfo, error)
func (*FakeFileSystem) ReadFile ¶
func (fs *FakeFileSystem) ReadFile(filename string) ([]byte, error)
func (*FakeFileSystem) RemoveAll ¶
func (fs *FakeFileSystem) RemoveAll(path string) error
func (*FakeFileSystem) TempDir ¶
func (fs *FakeFileSystem) TempDir(dir, prefix string) (string, error)
func (*FakeFileSystem) TempFile ¶
func (fs *FakeFileSystem) TempFile(dir, prefix string) (filesystem.NameWriteCloser, error)
func (*FakeFileSystem) WithDirectories ¶
func (fs *FakeFileSystem) WithDirectories(path ...string) *FakeFileSystem
func (*FakeFileSystem) WithDirectory ¶
func (fs *FakeFileSystem) WithDirectory(path string) *FakeFileSystem
func (*FakeFileSystem) WithFile ¶
func (fs *FakeFileSystem) WithFile(path string, data []byte) *FakeFileSystem
func (*FakeFileSystem) WithFileAndMode ¶
func (fs *FakeFileSystem) WithFileAndMode(path string, data []byte, mode os.FileMode) *FakeFileSystem
type FakeMapper ¶
type FakeMapper struct { meta.RESTMapper AutoReturnResource bool Resources map[schema.GroupVersionResource]schema.GroupVersionResource }
func (*FakeMapper) ResourceFor ¶
func (m *FakeMapper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, error)
type LocationInfo ¶
type MockPodCommandExecutor ¶
func (*MockPodCommandExecutor) ExecutePodCommand ¶
func (e *MockPodCommandExecutor) ExecutePodCommand(log logrus.FieldLogger, item map[string]interface{}, namespace, name, hookName string, hook *v1.ExecHook) error
type TestBackup ¶
func NewTestBackup ¶
func NewTestBackup() *TestBackup
func (*TestBackup) WithDeletionTimestamp ¶
func (b *TestBackup) WithDeletionTimestamp(time time.Time) *TestBackup
func (*TestBackup) WithExcludedNamespaces ¶
func (b *TestBackup) WithExcludedNamespaces(ns ...string) *TestBackup
func (*TestBackup) WithExcludedResources ¶
func (b *TestBackup) WithExcludedResources(r ...string) *TestBackup
func (*TestBackup) WithExpiration ¶
func (b *TestBackup) WithExpiration(expiration time.Time) *TestBackup
func (*TestBackup) WithFinalizers ¶
func (b *TestBackup) WithFinalizers(finalizers ...string) *TestBackup
func (*TestBackup) WithIncludedNamespaces ¶
func (b *TestBackup) WithIncludedNamespaces(ns ...string) *TestBackup
func (*TestBackup) WithIncludedResources ¶
func (b *TestBackup) WithIncludedResources(r ...string) *TestBackup
func (*TestBackup) WithLabel ¶
func (b *TestBackup) WithLabel(key, value string) *TestBackup
func (*TestBackup) WithName ¶
func (b *TestBackup) WithName(name string) *TestBackup
func (*TestBackup) WithNamespace ¶
func (b *TestBackup) WithNamespace(namespace string) *TestBackup
func (*TestBackup) WithPhase ¶
func (b *TestBackup) WithPhase(phase v1.BackupPhase) *TestBackup
func (*TestBackup) WithResourceVersion ¶
func (b *TestBackup) WithResourceVersion(version string) *TestBackup
func (*TestBackup) WithSnapshot ¶
func (b *TestBackup) WithSnapshot(pv string, snapshot string) *TestBackup
func (*TestBackup) WithSnapshotVolumes ¶
func (b *TestBackup) WithSnapshotVolumes(value bool) *TestBackup
func (*TestBackup) WithSnapshotVolumesPointer ¶
func (b *TestBackup) WithSnapshotVolumesPointer(value *bool) *TestBackup
func (*TestBackup) WithStartTimestamp ¶
func (b *TestBackup) WithStartTimestamp(startTime time.Time) *TestBackup
func (*TestBackup) WithStorageLocation ¶
func (b *TestBackup) WithStorageLocation(location string) *TestBackup
func (*TestBackup) WithTTL ¶
func (b *TestBackup) WithTTL(ttl time.Duration) *TestBackup
func (*TestBackup) WithVersion ¶
func (b *TestBackup) WithVersion(version int) *TestBackup
func (*TestBackup) WithVolumeBackupInfo ¶
func (b *TestBackup) WithVolumeBackupInfo(pv, snapshotID, volumeType, az string, iops *int64) *TestBackup
func (*TestBackup) WithVolumeSnapshotLocations ¶
func (b *TestBackup) WithVolumeSnapshotLocations(locations ...string) *TestBackup
type TestBackupStorageLocation ¶
type TestBackupStorageLocation struct {
*v1.BackupStorageLocation
}
func NewTestBackupStorageLocation ¶
func NewTestBackupStorageLocation() *TestBackupStorageLocation
func (*TestBackupStorageLocation) WithLabel ¶
func (b *TestBackupStorageLocation) WithLabel(key, value string) *TestBackupStorageLocation
func (*TestBackupStorageLocation) WithName ¶
func (b *TestBackupStorageLocation) WithName(name string) *TestBackupStorageLocation
func (*TestBackupStorageLocation) WithNamespace ¶
func (b *TestBackupStorageLocation) WithNamespace(namespace string) *TestBackupStorageLocation
func (*TestBackupStorageLocation) WithObjectStorage ¶
func (b *TestBackupStorageLocation) WithObjectStorage(bucketName string) *TestBackupStorageLocation
func (*TestBackupStorageLocation) WithProvider ¶
func (b *TestBackupStorageLocation) WithProvider(name string) *TestBackupStorageLocation
type TestRestore ¶
func NewDefaultTestRestore ¶
func NewDefaultTestRestore() *TestRestore
func NewTestRestore ¶
func NewTestRestore(ns, name string, phase api.RestorePhase) *TestRestore
func (*TestRestore) WithBackup ¶
func (r *TestRestore) WithBackup(name string) *TestRestore
func (*TestRestore) WithErrors ¶
func (r *TestRestore) WithErrors(i int) *TestRestore
func (*TestRestore) WithExcludedNamespace ¶
func (r *TestRestore) WithExcludedNamespace(name string) *TestRestore
func (*TestRestore) WithExcludedResource ¶
func (r *TestRestore) WithExcludedResource(resource string) *TestRestore
func (*TestRestore) WithIncludedNamespace ¶
func (r *TestRestore) WithIncludedNamespace(name string) *TestRestore
func (*TestRestore) WithIncludedResource ¶
func (r *TestRestore) WithIncludedResource(resource string) *TestRestore
func (*TestRestore) WithMappedNamespace ¶
func (r *TestRestore) WithMappedNamespace(from string, to string) *TestRestore
func (*TestRestore) WithRestorePVs ¶
func (r *TestRestore) WithRestorePVs(value bool) *TestRestore
func (*TestRestore) WithSchedule ¶
func (r *TestRestore) WithSchedule(name string) *TestRestore
func (*TestRestore) WithValidationError ¶
func (r *TestRestore) WithValidationError(err string) *TestRestore
type TestSchedule ¶
func NewTestSchedule ¶
func NewTestSchedule(namespace, name string) *TestSchedule
func (*TestSchedule) WithCronSchedule ¶
func (s *TestSchedule) WithCronSchedule(cronExpression string) *TestSchedule
func (*TestSchedule) WithLastBackupTime ¶
func (s *TestSchedule) WithLastBackupTime(timeString string) *TestSchedule
func (*TestSchedule) WithPhase ¶
func (s *TestSchedule) WithPhase(phase api.SchedulePhase) *TestSchedule
func (*TestSchedule) WithValidationError ¶
func (s *TestSchedule) WithValidationError(msg string) *TestSchedule
type TestVolumeSnapshotLocation ¶
type TestVolumeSnapshotLocation struct {
*v1.VolumeSnapshotLocation
}
func NewTestVolumeSnapshotLocation ¶
func NewTestVolumeSnapshotLocation() *TestVolumeSnapshotLocation
func (*TestVolumeSnapshotLocation) WithName ¶
func (location *TestVolumeSnapshotLocation) WithName(name string) *TestVolumeSnapshotLocation
func (*TestVolumeSnapshotLocation) WithProvider ¶
func (location *TestVolumeSnapshotLocation) WithProvider(name string) *TestVolumeSnapshotLocation
func (*TestVolumeSnapshotLocation) WithProviderConfig ¶
func (location *TestVolumeSnapshotLocation) WithProviderConfig(info []LocationInfo) []*TestVolumeSnapshotLocation