How to run integration tests against S3 back-end

I see there are integration tests on Github (duplicacy/integration_tests at master · gilbertchen/duplicacy · GitHub) but in one of them it says it is for local storage only. Elsewhere in the code some tests are vendor-specific (e.g. Wasabi).

How about S3-compatible storage - how does one test it? Is it enough to benchmark it, or is there a way to run a more complete test?

2 Likes

You can run unit tests against an s3 storage this way:

go test -run TestStorage ./src -storage s3
go test -run TestBackupManager ./src -storage s3

For that to work you’ll need to create a file named test_storage.conf under ./src with the following content:

{
    "s3" : {
        "region": "",
        "endpoint": "server",
        "bucket": "bucket",
        "directory": "directory",
        "access_key": "access_key",
        "secret_key": "secret_key"
    }
}
2 Likes

Cool, thank you!

Sadly I hit this go issue that’s been open for a while and doesn’t seem fixed in the latest release (v1.15).

go test -run TestStorage ./src -storage s3
flag provided but not defined: -test.timeout

So I downgraded golang to v1.12 (that version didn’t have the above bug), but then I hit another problem - ../../Azure/go-autorest/autorest/adal/token.go:1193:12: undefined: http.NewRequestWithContext. It turns out that was added in v1.13 so I’d need v1.13 which already has the bug which prevents the test from running.

This isn’t urgent for me so I’ll revisit this after next golang or Duplicacy update. In the meantime if anyone figures this out I may revisit sooner.

You can roll back github.com/Azure/go-autorest to a previous version if that doesn’t interfere with your other go projects. Or you can run $GOPATH/bin/dep ensure to create a vendor directory (assuming you have dep installed).

1 Like

Thank you, it’d have taken me days to figure that out.

So I nuked the Azure repo clone and downloaded some older version (v0.11.1, if anyone’s curious, but I didn’t require Azure test functionality so this didn’t matter for my test).

sss@solidbackup:~/go/src/github.com/gilbertchen/duplicacy$ go test -run TestStorage ./src -storage s3
ok      github.com/gilbertchen/duplicacy/src    101.290s
sss@solidbackup:~/go/src/github.com/gilbertchen/duplicacy$ go test -run TestBackupManager ./src -storage s3
ok      github.com/gilbertchen/duplicacy/src    102.032s

:white_check_mark: :ok:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.