2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-14 09:14:07 +00:00
restic/internal/backend/gs/config_test.go
2023-05-26 19:54:42 +02:00

44 lines
864 B
Go

package gs
import "testing"
var configTests = []struct {
s string
cfg Config
}{
{"gs:bucketname:/", Config{
Bucket: "bucketname",
Prefix: "",
Connections: 5,
Region: "us",
}},
{"gs:bucketname:/prefix/directory", Config{
Bucket: "bucketname",
Prefix: "prefix/directory",
Connections: 5,
Region: "us",
}},
{"gs:bucketname:/prefix/directory/", Config{
Bucket: "bucketname",
Prefix: "prefix/directory",
Connections: 5,
Region: "us",
}},
}
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
}
}
}