mirror of
https://github.com/restic/restic.git
synced 2026-10-17 23:18:12 +00:00
backend: use generic implementation for ParseConfig tests
This commit is contained in:
1 parent
5260d38980
commit
fa361dbfbd
9 files changed
+87
-156
No files matched your search
@@ -3,12 +3,11 @@ package s3
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/internal/backend/test"
|
||||
)
|
||||
|
||||
var configTests = []struct {
|
||||
s string
|
||||
cfg Config
|
||||
}{
|
||||
var configTests = []test.ConfigTestData[Config]{
|
||||
{"s3://eu-central-1/bucketname", Config{
|
||||
Endpoint: "eu-central-1",
|
||||
Bucket: "bucketname",
|
||||
@@ -100,19 +99,7 @@ var configTests = []struct {
|
||||
}
|
||||
|
||||
func TestParseConfig(t *testing.T) {
|
||||
for i, test := range configTests {
|
||||
cfg, err := ParseConfig(test.s)
|
||||
if err != nil {
|
||||
t.Errorf("test %d:%s failed: %v", i, test.s, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if cfg != test.cfg {
|
||||
t.Errorf("test %d:\ninput:\n %s\n wrong config, want:\n %v\ngot:\n %v",
|
||||
i, test.s, test.cfg, cfg)
|
||||
continue
|
||||
}
|
||||
}
|
||||
test.ParseConfigTester(t, ParseConfig, configTests)
|
||||
}
|
||||
|
||||
func TestParseError(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user