Skip to content

Commit

Permalink
Remove cyclic dependency from fake_restic_executer.go; minor formatting
Browse files Browse the repository at this point in the history
Signed-off-by: F. Gold <fgold@vmware.com>
  • Loading branch information
codegold79 committed Mar 6, 2021
1 parent b75852a commit 0257158
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/velero/v1/pod_volume_operation_progress.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019 the Velero contributors.
Copyright The Velero Contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/pod_volume_backup_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
apierrors "k8s.io/apimachinery/pkg/api/errors"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/clock"
Expand Down
11 changes: 8 additions & 3 deletions pkg/restic/executer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@ limitations under the License.
package restic

import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
)

// BackupExecuter ...
type BackupExecuter interface {
RunBackup(*Command, logrus.FieldLogger, func(velerov1api.PodVolumeOperationProgress)) (string, string, error)
RunBackup(interface{}, logrus.FieldLogger, func(velerov1api.PodVolumeOperationProgress)) (string, string, error)
GetSnapshotID(string, string, map[string]string, []string, string) (string, error)
}

// Backup ...
// BackupExec ...
type BackupExec struct{}

// RunBackup ...
func (exec BackupExec) RunBackup(cmd *Command, log logrus.FieldLogger, updateFn func(velerov1api.PodVolumeOperationProgress)) (string, string, error) {
func (exec BackupExec) RunBackup(command interface{}, log logrus.FieldLogger, updateFn func(velerov1api.PodVolumeOperationProgress)) (string, string, error) {
cmd, ok := command.(*Command)
if !ok {
return "", "", errors.New("expecting command to be of type *restic.Command")
}
return RunBackup(cmd, log, updateFn)
}

Expand Down
6 changes: 2 additions & 4 deletions pkg/test/fake_restic_executer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ package test

import (
"github.com/sirupsen/logrus"

velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/restic"
)

// Backup ...
// FakeResticBackupExec ...
type FakeResticBackupExec struct{}

// RunBackup ...
func (exec FakeResticBackupExec) RunBackup(cmd *restic.Command, log logrus.FieldLogger, updateFn func(velerov1api.PodVolumeOperationProgress)) (string, string, error) {
func (exec FakeResticBackupExec) RunBackup(cmd interface{}, log logrus.FieldLogger, updateFn func(velerov1api.PodVolumeOperationProgress)) (string, string, error) {
return "", "", nil
}

Expand Down

0 comments on commit 0257158

Please sign in to comment.