backend/rclone: Skip test if binary is unavailable

This commit is contained in:
Alexander Neumann 2018-03-14 21:14:54 +01:00
parent 4dc0f24b38
commit 065fe1e54f
1 changed files with 8 additions and 1 deletions

View File

@ -4,11 +4,13 @@ import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/restic/restic/internal/backend/rclone"
"github.com/restic/restic/internal/backend/test"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/restic"
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) {
t.Logf("Create()")
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.