func TestLoadJSONUnpacked(t *testing.T) { repo := SetupRepo() defer TeardownRepo(repo) if BenchArchiveDirectory == "" { t.Skip("benchdir not set, skipping") } // archive a snapshot sn := restic.Snapshot{} sn.Hostname = "foobar" sn.Username = "******" id, err := repo.SaveJSONUnpacked(backend.Snapshot, &sn) OK(t, err) var sn2 restic.Snapshot // restore err = repo.LoadJSONUnpacked(backend.Snapshot, id, &sn2) OK(t, err) Equals(t, sn.Hostname, sn2.Hostname) Equals(t, sn.Username, sn2.Username) }
func TestLoadJSONUnpacked(t *testing.T) { repo, cleanup := repository.TestRepository(t) defer cleanup() if BenchArchiveDirectory == "" { t.Skip("benchdir not set, skipping") } // archive a snapshot sn := restic.Snapshot{} sn.Hostname = "foobar" sn.Username = "******" id, err := repo.SaveJSONUnpacked(restic.SnapshotFile, &sn) OK(t, err) var sn2 restic.Snapshot // restore err = repo.LoadJSONUnpacked(restic.SnapshotFile, id, &sn2) OK(t, err) Equals(t, sn.Hostname, sn2.Hostname) Equals(t, sn.Username, sn2.Username) }