2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-14 09:14:07 +00:00
restic/internal/backend/azure/config_test.go
Dipta Das 3a85b6b7c6 Add Azure Blob Storage as backend
Environment variables:
AZURE_ACCOUNT_NAME=storage-account-name
AZURE_ACCOUNT_KEY=storage-account-key

Environment variables for test:
RESTIC_TEST_AZURE_ACCOUNT_NAME=storage-account-name
RESTIC_TEST_AZURE_ACCOUNT_KEY=storage-account-key
RESTIC_TEST_AZURE_REPOSITORY=azure:restic-test-container

Init repository:
$ restic -r azure:container-name:/prefix/dir init
2017-08-06 21:47:04 +02:00

41 lines
837 B
Go

package azure
import "testing"
var configTests = []struct {
s string
cfg Config
}{
{"azure:container-name:/", Config{
Container: "container-name",
Prefix: "",
Connections: 5,
}},
{"azure:container-name:/prefix/directory", Config{
Container: "container-name",
Prefix: "prefix/directory",
Connections: 5,
}},
{"azure:container-name:/prefix/directory/", Config{
Container: "container-name",
Prefix: "prefix/directory",
Connections: 5,
}},
}
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
}
}
}