| 51 | } |
| 52 | |
| 53 | func TestSimpleVersioningVersionCount(t *testing.T) { |
| 54 | if testing.Short() { |
| 55 | t.Skip("Test takes some time, skipping.") |
| 56 | } |
| 57 | |
| 58 | dir := t.TempDir() |
| 59 | |
| 60 | cfg := config.FolderConfiguration{ |
| 61 | FilesystemType: config.FilesystemTypeBasic, |
| 62 | Path: dir, |
| 63 | Versioning: config.VersioningConfiguration{ |
| 64 | Params: map[string]string{ |
| 65 | "keep": "2", |
| 66 | }, |
| 67 | }, |
| 68 | } |
| 69 | fs := cfg.Filesystem() |
| 70 | |
| 71 | v := newSimple(cfg) |
| 72 | |
| 73 | path := "test" |
| 74 | |
| 75 | for i := 1; i <= 3; i++ { |
| 76 | f, err := fs.Create(path) |
| 77 | if err != nil { |
| 78 | t.Error(err) |
| 79 | } |
| 80 | f.Close() |
| 81 | if err := v.Archive(path); err != nil { |
| 82 | t.Error(err) |
| 83 | } |
| 84 | |
| 85 | n, err := fs.DirNames(DefaultPath) |
| 86 | if err != nil { |
| 87 | t.Error(err) |
| 88 | } |
| 89 | |
| 90 | if len(n) != min(i, 2) { |
| 91 | t.Error("Wrong count") |
| 92 | } |
| 93 | |
| 94 | time.Sleep(time.Second) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | func TestPathTildes(t *testing.T) { |
| 99 | // Test that folder and version paths with leading tildes are expanded |