mirror of
https://github.com/restic/restic.git
synced 2025-08-12 09:38:00 +00:00
backend/rclone: Skip test if binary is unavailable
This commit is contained in:
@@ -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.
|
||||||
|
Reference in New Issue
Block a user