forked from TrueCloudLab/restic
backend/rclone: Skip test if binary is unavailable
This commit is contained in:
parent
4dc0f24b38
commit
065fe1e54f
1 changed files with 8 additions and 1 deletions
|
@ -4,11 +4,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/backend/rclone"
|
"github.com/restic/restic/internal/backend/rclone"
|
||||||
"github.com/restic/restic/internal/backend/test"
|
"github.com/restic/restic/internal/backend/test"
|
||||||
|
"github.com/restic/restic/internal/errors"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
rtest "github.com/restic/restic/internal/test"
|
rtest "github.com/restic/restic/internal/test"
|
||||||
)
|
)
|
||||||
|
@ -49,7 +51,12 @@ func newTestSuite(t testing.TB) *test.Suite {
|
||||||
Create: func(config interface{}) (restic.Backend, error) {
|
Create: func(config interface{}) (restic.Backend, error) {
|
||||||
t.Logf("Create()")
|
t.Logf("Create()")
|
||||||
cfg := config.(rclone.Config)
|
cfg := config.(rclone.Config)
|
||||||
return rclone.Create(cfg)
|
be, err := rclone.Create(cfg)
|
||||||
|
if e, ok := errors.Cause(err).(*exec.Error); ok && e.Err == exec.ErrNotFound {
|
||||||
|
t.Skipf("program %q not found", e.Name)
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return be, err
|
||||||
},
|
},
|
||||||
|
|
||||||
// OpenFn is a function that opens a previously created temporary repository.
|
// OpenFn is a function that opens a previously created temporary repository.
|
||||||
|
|
Loading…
Reference in a new issue