mirror of
https://github.com/kopia/kopia.git
synced 2026-03-27 18:42:26 -04:00
tests: added smoke test that exercises all combinations of encryption and hashing
This commit is contained in:
45
tests/end_to_end_test/all_formats_test.go
Normal file
45
tests/end_to_end_test/all_formats_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package endtoend_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kopia/kopia/repo/encryption"
|
||||
"github.com/kopia/kopia/repo/hashing"
|
||||
"github.com/kopia/kopia/tests/testenv"
|
||||
)
|
||||
|
||||
func TestAllFormatsSmokeTest(t *testing.T) {
|
||||
for _, encryptionAlgo := range encryption.SupportedAlgorithms(false) {
|
||||
encryptionAlgo := encryptionAlgo
|
||||
|
||||
t.Run(encryptionAlgo, func(t *testing.T) {
|
||||
for _, hashAlgo := range hashing.SupportedAlgorithms() {
|
||||
|
||||
hashAlgo := hashAlgo
|
||||
t.Run(hashAlgo, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
e := testenv.NewCLITest(t)
|
||||
defer e.Cleanup(t)
|
||||
defer e.RunAndExpectSuccess(t, "repo", "disconnect")
|
||||
|
||||
e.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", e.RepoDir, "--block-hash", hashAlgo, "--encryption", encryptionAlgo)
|
||||
e.RunAndExpectSuccess(t, "snap", "create", sharedTestDataDir1)
|
||||
|
||||
sources := e.ListSnapshotsAndExpectSuccess(t)
|
||||
if got, want := len(sources), 1; got != want {
|
||||
t.Errorf("unexpected number of sources: %v, want %v in %#v", got, want, sources)
|
||||
}
|
||||
|
||||
e.RunAndExpectSuccess(t, "repo", "disconnect")
|
||||
e.RunAndExpectSuccess(t, "repo", "connect", "filesystem", "--path", e.RepoDir)
|
||||
|
||||
sources = e.ListSnapshotsAndExpectSuccess(t)
|
||||
if got, want := len(sources), 1; got != want {
|
||||
t.Errorf("unexpected number of sources: %v, want %v in %#v", got, want, sources)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user