I want to verify basic functionality (unit tests) for my rclone build by running go test.
That kind of generic test fails with rclone 1.53.1 because of integration tests, which does make sense since I don't have servers configured. I just want to make sure local functions are working.
The tests for various backends (azureblob, b2, box, etc) run TestIntegration through fstest/testserver. testserver tries to find a nearby init.d directory, which is not present in the build dir. In the source tree there is fstest/testserver/init.d with some test server configurations available using docker. But I don't want to activate these test servers or install docker.
Hence the TestIntegration for each backend fails with the error message
couldn't find testserver config files - run from within rclone source
and go test returns a FAIL status.
I'd like to just skip these TestIntegration. It's sufficient for me to just confirm that local non-server functionality is working. I could skip each TestIntegration one by one by applying t.Skip() to it in the _test.go file for each backend.
What I'd like to know, is there are simpler way to skip TestIntegration once for all tests rather than hacking each backend test file? Or is there a way to treat couldn't find testserver config files as a warning or message (i.e. ignoring the problem and moving on) rather than as a failing error?
Previously in rclone 1.50.2, failure to find backend config files triggered a skip rather than a fail, e.g.
Didn't find "TestAzureBlob:" in config file - skipping tests
Thanks @ncw. That almost works a charm. Inspecting the details of make quicktest suggests to me the key is setting RCLONE_CONFIG="/notfound" in the environment for the test command, which works with the Debian tools I'm using (RCLONE_CONFIG="/notfound" dh_auto_test).
The backends I reported on then pass cleanly, e.g.
=== RUN TestIntegration
fstests.go:302: quicktest only
--- SKIP: TestIntegration (0.00s)
PASS
ok github.com/rclone/rclone/backend/azureblob 0.044s
Two backends don't recognise the quicktest condition though,
e.g. sftp,
=== RUN TestIntegration
2020/09/29 00:35:12 NOTICE: Config file "/notfound" not found - using defaults
fstests.go:357: Using remote "sftptest:"
fstests.go:367:
Error Trace: fstests.go:367
sftp_test.go:17
Error: Received unexpected error:
couldn't find testserver config files - run from within rclone source
github.com/rclone/rclone/fstest/testserver.findConfig
/projects/golang/build/rclone/obj-x86_64-linux-gnu/src/github.com/rclone/rclone/fstest/testserver/testserver.go:42
github.com/rclone/rclone/fstest/testserver.Start.func3
/projects/golang/build/rclone/obj-x86_64-linux-gnu/src/github.com/rclone/rclone/fstest/testserver/testserver.go:137
sync.(*Once).doSlow
/usr/lib/go-1.15/src/sync/once.go:66
sync.(*Once).Do
/usr/lib/go-1.15/src/sync/once.go:57
github.com/rclone/rclone/fstest/testserver.Start
/projects/golang/build/rclone/obj-x86_64-linux-gnu/src/github.com/rclone/rclone/fstest/testserver/testserver.go:136
github.com/rclone/rclone/fstest/fstests.Run
/projects/golang/build/rclone/obj-x86_64-linux-gnu/src/github.com/rclone/rclone/fstest/fstests/fstests.go:366
github.com/rclone/rclone/backend/sftp_test.TestIntegration
/projects/golang/build/rclone/obj-x86_64-linux-gnu/src/github.com/rclone/rclone/backend/sftp/sftp_test.go:17
testing.tRunner
/usr/lib/go-1.15/src/testing/testing.go:1127
runtime.goexit
/usr/lib/go-1.15/src/runtime/asm_amd64.s:1374
Test: TestIntegration
--- FAIL: TestIntegration (0.00s)
Likewise in webdav.
Only sftp and webdav are giving this TestIntegration failure now. Other backends, including azureblob, b2, box, etc, recognise the "quicktest only" condition and pass the test. (note, this is output from RCLONE_CONFIG="/notfound" dh_auto_test rather than make quicktest)
Is this a bug in the sftp and webdav TestIntegrations ?
At the moment the test script is set up to run all tests from the toplevel, so not so convenient to cd down to the specific sftp and webdav dirs to get the failing tests to pass.
On the other hand, with only the two of them misbehaving, it's easy enough to apply the t.Skip() hack to skip TestIntegration for just those two backends. That, together with RCLONE_CONFIG="/notfound", will work for me. Thanks for your help!