From 382f253753ba11ddb4a5a458ef810b0394d863f0 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Fri, 13 Mar 2020 18:42:20 -0700 Subject: [PATCH] tests: added smoke test that exercises all combinations of encryption and hashing --- tests/end_to_end_test/all_formats_test.go | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/end_to_end_test/all_formats_test.go diff --git a/tests/end_to_end_test/all_formats_test.go b/tests/end_to_end_test/all_formats_test.go new file mode 100644 index 0000000000..6b7c0e9643 --- /dev/null +++ b/tests/end_to_end_test/all_formats_test.go @@ -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) + } + }) + } + }) + } +}