Eng Zer Jun and GitHub
bc27aa12cd
all: use T.TempDir to create temporary test directory ( #8280 )
...
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.
Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
defer func() {
if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
}
is also tedious, but `t.TempDir` handles this for us nicely.
Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com >
2022-04-15 07:44:06 +04:00
Simon Frei and GitHub
db72579f0e
lib: Get rid of buggy filesystem wrapping ( #8257 )
2022-04-10 20:55:05 +02:00
Simon Frei and GitHub
635085d139
lib/db, lib/model: Remove filesystem state from FileSet ( fixes #7850 ) ( #8151 )
2022-01-31 10:12:52 +01:00
Jakob Borg and GitHub
4b750b6dc3
all: Remove usage of deprecated io/ioutil ( #7971 )
...
As of Go 1.16 io/ioutil is deprecated. This replaces usage with the
corresponding functions in package os and package io.
2021-11-22 08:59:47 +01:00
Simon Frei and GitHub
591e4d8af1
gui, lib: Fix tracking deleted locally-changed on encrypted ( fixes #7715 ) ( #7726 )
2021-11-10 09:46:21 +01:00
tomasz1986 and GitHub
5a1f6cb813
lib/fs: Improve case conflict error message ( fixes #7827 ) ( #7829 )
2021-08-01 22:44:49 +02:00
Simon Frei and GitHub
df48276300
lib/model: Ensure indexes are only received after checking IDs (ref #7649 ) ( #7689 )
2021-06-03 14:58:50 +02:00
Simon Frei and GitHub
5b90a98650
lib/model: Fix addFakeConn and other test improvements ( #7684 )
2021-05-16 17:23:27 +02:00
Simon Frei and GitHub
310fba4c12
lib: Return error from db.FileSet.Snapshot ( fixes #7419 , ref #5907 ) ( #7424 )
2021-03-07 13:43:22 +01:00
Simon Frei and GitHub
ffc14a77c6
all: Add configurable defaults ( fixes #4224 , fixes #6086 ) ( #7131 )
2021-02-04 21:10:41 +01:00
Simon Frei and GitHub
f63cdbfcfa
lib: Apply config changes sequentially (ref #5298 ) ( #7188 )
2021-01-15 15:43:34 +01:00
Simon Frei and GitHub
c48eb4241a
lib/model: Fix child-check when deleting dirs in pull ( #7236 )
2021-01-02 21:40:37 +01:00
Simon Frei and GitHub
a05dc6cc47
lib/model: Cleanup redundant filesystem variables in folders ( #7237 )
2020-12-27 22:26:25 +01:00
Simon Frei and GitHub
78bd0341a8
all: Handle errors opening db/creating file-set (ref #5907 ) ( #7150 )
2020-12-21 12:59:22 +01:00
Simon Frei and GitHub
9524b51708
all: Implement suture v4-api ( #6947 )
2020-11-17 13:19:04 +01:00
Simon Frei and GitHub
cc9ea9db89
lib/folder: Clear pull errors when nothing is needed anymore ( #7093 )
2020-11-06 14:22:20 +01:00
Audrius Butkevicius and GitHub
e027175446
all: Move remaining protos to use the vanity plugin ( #7009 )
2020-10-02 08:07:05 +02:00
Simon Frei and GitHub
8210466b03
lib/model: Consider case conflicts when checking to be deleted items ( #6986 )
2020-09-12 07:45:50 +02:00
Simon Frei and GitHub
c5c23ed10f
lib/model: Consider existing file when handling symlink on windows ( #6977 )
2020-09-10 10:52:38 +02:00
Simon Frei and GitHub
56d48d341f
lib/model: Fix case-only renames on pull ( #6978 )
2020-09-10 08:23:54 +02:00
Simon Frei and GitHub
e3cd9219b8
lib/model: Don't fail over case-conflict on tempfile ( fixes #6973 ) ( #6975 )
2020-09-09 11:47:14 +02:00
Audrius Butkevicius and GitHub
e9bb17307d
lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref #6875 ) ( #6877 )
2020-08-07 07:47:48 +02:00
Audrius Butkevicius and GitHub
96e197e502
lib/model: Don't close file early ( fixes #6875 ) ( #6876 )
2020-08-03 21:54:42 +02:00
Simon Frei and Jakob Borg
932d8c69de
lib/fs: Properly handle case insensitive systems ( fixes #1787 , fixes #2739 , fixes #5708 )
...
With this change we emulate a case sensitive filesystem on top of
insensitive filesystems. This means we correctly pick up case-only renames
and throw a case conflict error when there would be multiple files differing
only in case.
This safety check has a small performance hit (about 20% more filesystem
operations when scanning for changes). The new advanced folder option
`caseSensitiveFS` can be used to disable the safety checks, retaining the
previous behavior on systems known to be fully case sensitive.
Co-authored-by: Jakob Borg <jakob@kastelo.net >
2020-07-28 11:15:11 +02:00
Audrius Butkevicius and GitHub
4812fd3ec1
all: Add copy-on-write filesystem support ( fixes #4271 ) ( #6746 )
2020-06-18 08:15:47 +02:00
Simon Frei and GitHub
6976219d6d
lib/model: Check dir before deletion when pulling ( #6741 )
2020-06-16 15:20:08 +02:00
Simon Frei and GitHub
c3b5eba205
lib/model: Fix checking children when trying to delete a dir ( fixes #6646 ) ( #6647 )
2020-05-25 08:46:24 +02:00
Audrius Butkevicius and GitHub
a1c5b44c74
lib/model: Fix rename handling (ref #6650 ) ( #6652 )
2020-05-16 14:39:27 +02:00
Simon Frei and GitHub
b5fc332782
lib/model: Merge add and start folder funcs and related refactor ( #6594 )
2020-05-06 08:34:54 +02:00
Audrius Butkevicius and GitHub
782bd08aad
lib/model: Add option to disable fsync ( #6588 )
...
* lib/model: Add option to disable fsync
* Fix test
* Dont open stuff for no reason
2020-05-01 08:36:46 +01:00
Jakob Borg and GitHub
6c73617974
lib/model: Use semaphore to limit concurrent folder writes ( fixes #6541 ) ( #6573 )
2020-04-27 00:13:18 +02:00
Simon Frei and GitHub
d3ed4de4ed
lib/model: Don't exit pullerRoutine on cancelled ctx ( fixes #6559 ) ( #6562 )
...
* lib/model: Don't exit pullerRoutine on cancelled ctx (fixes #6559 )
* actual fix
2020-04-21 18:55:14 +01:00
Simon Frei and Jakob Borg
08f0e125ef
all: Transactionalize db.FileSet ( fixes #5952 ) ( #6239 )
2020-01-21 18:23:08 +01:00
Jakob Borg and GitHub
c71116ee94
Implement database abstraction, error checking (ref #5907 ) ( #6107 )
...
This PR does two things, because one lead to the other:
- Move the leveldb specific stuff into a small "backend" package that
defines a backend interface and the leveldb implementation. This allows,
potentially, in the future, switching the db implementation so another
KV store should we wish to do so.
- Add proper error handling all along the way. The db and backend
packages are now errcheck clean. However, I drew the line at modifying
the FileSet API in order to keep this manageable and not continue
refactoring all of the rest of Syncthing. As such, the FileSet methods
still panic on database errors, except for the "database is closed"
error which is instead handled by silently returning as quickly as
possible, with the assumption that we're anyway "on the way out".
2019-11-29 09:11:52 +01:00
Simon Frei and GitHub
5edf4660e2
lib/model: Prevent cleanup-race in testing (ref #6152 ) ( #6155 )
2019-11-14 23:08:40 +01:00
Simon Frei and GitHub
f80ce17497
lib/model: In tests prevent goroutine leaks and increase timeouts ( #6152 )
2019-11-13 10:21:54 +01:00
Simon Frei and Jakob Borg
85e6a77f25
lib/model: Remove some testing deadlocks ( #6138 )
2019-11-08 18:53:51 +01:00
Simon Frei and GitHub
bee7cce081
lib/model: Add folders on start in model ( #6135 )
2019-11-08 10:56:16 +01:00
Simon Frei and Jakob Borg
bbdda059bd
lib/model: Check for symlinks before deleting during pull ( fixes #6090 ) ( #6100 )
2019-10-22 21:55:51 +02:00
Simon Frei and Jakob Borg
b677464dfa
lib/model: Optimise locking around conn-close and puller states ( #5954 )
2019-08-16 09:35:19 +02:00
Simon Frei and GitHub
b1c74860e8
all: Remove global events.Default (ref #4085 ) ( #5886 )
2019-08-15 16:29:37 +02:00
Simon Frei and Jakob Borg
395e524e2d
lib/model: Update db on scan/pull in folder ( #5608 )
2019-04-07 13:29:17 +02:00
Simon Frei and Jakob Borg
d4e81fff8a
lib/model: Remove unnecessary arguments in pulling functions ( #5619 )
2019-03-25 12:59:22 +01:00
Simon Frei and Jakob Borg
445637ebec
lib/model: Pass fset & ignores on folder creation ( #5592 )
2019-03-11 07:28:54 +01:00
Simon Frei and Audrius Butkevicius
189e44488e
lib/model: Introduce must test utility ( #5586 )
...
* lib/model: Introduce must test utility
* nice
2019-03-09 18:45:36 +00:00
Simon Frei and Audrius Butkevicius
b1564e53e4
lib/model: Improve test utilities ( #5584 )
2019-03-08 20:29:09 +00:00
Simon Frei and GitHub
8e238c8e48
lib/model: Check before replacing existing file on pull ( fixes #5571 ) ( #5567 )
2019-03-07 15:15:14 +01:00
Simon Frei and Audrius Butkevicius
6940d79f5b
lib/model: Use errors.Wrap for pull errors ( #5563 )
2019-03-04 13:01:52 +00:00
Simon Frei and Audrius Butkevicius
d6622b1f68
lib/model: setUp -> setup ( #5573 )
2019-03-04 12:27:10 +00:00
Simon Frei and Audrius Butkevicius
722b3fce6a
all: Hide implementations behind interfaces for mocked testing ( #5548 )
...
* lib/model: Hide implementations behind interfaces for mocked testing
* review
2019-02-26 08:09:25 +00:00