mirror of
https://github.com/restic/restic.git
synced 2025-10-09 07:33:53 +00:00
backend: let ParseConfig return concrete type
This commit is contained in:
@@ -26,16 +26,16 @@ func NewConfig() Config {
|
||||
}
|
||||
|
||||
// ParseConfig parses the string s and extracts the REST server URL.
|
||||
func ParseConfig(s string) (interface{}, error) {
|
||||
func ParseConfig(s string) (Config, error) {
|
||||
if !strings.HasPrefix(s, "rest:") {
|
||||
return nil, errors.New("invalid REST backend specification")
|
||||
return Config{}, errors.New("invalid REST backend specification")
|
||||
}
|
||||
|
||||
s = prepareURL(s)
|
||||
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
return Config{}, errors.WithStack(err)
|
||||
}
|
||||
|
||||
cfg := NewConfig()
|
||||
|
@@ -130,12 +130,10 @@ func TestBackendRESTExternalServer(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c := cfg.(rest.Config)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
newTestSuite(ctx, t, c.URL, true).RunTests(t)
|
||||
newTestSuite(ctx, t, cfg.URL, true).RunTests(t)
|
||||
}
|
||||
|
||||
func BenchmarkBackendREST(t *testing.B) {
|
||||
|
Reference in New Issue
Block a user