Skip to content

Commit

Permalink
Adapt configuration tests for re/store excludes
Browse files Browse the repository at this point in the history
  • Loading branch information
penguwin authored and muesli committed Sep 2, 2020
1 parent c64c04b commit b7cc5c6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/aesbackend_test.go
Expand Up @@ -12,6 +12,7 @@ import (
"net/url"
"os"
"path/filepath"
"reflect"
"testing"
)

Expand Down Expand Up @@ -50,6 +51,13 @@ func TestAESBackendLoad(t *testing.T) {
if repo.Tolerance != 0 {
t.Errorf("Expected repoTolerance of 0, got: %v", repo.Tolerance)
}
excludes := []string{"just", "an", "example"}
if !reflect.DeepEqual(repo.StoreExcludes, excludes) {
t.Errorf("Store Excludes did not match:\nExpected: %v\nGot: %v", excludes, repo.StoreExcludes)
}
if !reflect.DeepEqual(repo.RestoreExcludes, excludes) {
t.Errorf("Restore Excludes did not match:\nExpected: %v\nGot: %v", excludes, repo.RestoreExcludes)
}

// try to load the config with a wrong password
u = &url.URL{
Expand Down
8 changes: 8 additions & 0 deletions config/filebackend_test.go
Expand Up @@ -12,6 +12,7 @@ import (
"net/url"
"os"
"path/filepath"
"reflect"
"testing"
)

Expand Down Expand Up @@ -50,6 +51,13 @@ func TestFileLoad(t *testing.T) {
if repo.Tolerance != 0 {
t.Errorf("Expected repoTolerance of 0, got: %v", repo.Tolerance)
}
excludes := []string{"just", "an", "example"}
if !reflect.DeepEqual(repo.StoreExcludes, excludes) {
t.Errorf("Store Excludes did not match:\nExpected: %v\nGot: %v", excludes, repo.StoreExcludes)
}
if !reflect.DeepEqual(repo.RestoreExcludes, excludes) {
t.Errorf("Restore Excludes did not match:\nExpected: %v\nGot: %v", excludes, repo.RestoreExcludes)
}

// try to load the config from an absolute path using a URI
cwd, _ := os.Getwd()
Expand Down
Binary file modified config/testdata/knoxite-crypto.conf
Binary file not shown.
12 changes: 11 additions & 1 deletion config/testdata/knoxite.conf
Expand Up @@ -4,7 +4,17 @@
"url": "/tmp/knoxitetest",
"compression": "gzip",
"tolerance": 0,
"encryption": "aes"
"encryption": "aes",
"store_excludes": [
"just",
"an",
"example"
],
"restore_excludes": [
"just",
"an",
"example"
]
}
}
}

0 comments on commit b7cc5c6

Please sign in to comment.