I started looking into how to write tests for the receiveonly folder type and adding it to the integration tests seems to be the easiest and makes most sense. How do I execute the integration tests? They don’t seem to be running via “go run build.go test” and I haven’t found any other options for it.
They are unmaintained and to a large extent probably non-functional apart from a few well known ones. That said… They live in
test. To use them,
- Make sure you have a build in
build.gowithout parameters gets you this.
go test -v -tags integration -run SyncClusterto run a number of sync tests.
Look around to see what is available. The tests mostly use a helper to start up Syncthing, the
lib/rc package to interact with it, and checks the results on disk. Leave off the
-run to run all the integration tests, but I guarantee many will fail.
There are a couple of benchmark tests that use another build tag;
go test -tags "integration benchmark" -run LargeFile2G for example.
As an alternative, possibly, look at the
lib/model which test drives just the model and checks expectations on how it reacts in terms of generating requests and index updates. That may cover your needs without need for involving the integration tests.