Running svfs tests
August 26, 2016 ยท View on GitHub
When contributing to svfs, you'll have to make sure you contribution doesn't break current features. Always make sure unit and integration tests pass.
Unit tests
Authentication
In order to test features against a remote Swift storage, tests use your environment for authentication :
- Set
SVFS_TEST_AUTHto eitherHUBIC,OPENRCorTOKEN. - Set relevant variables as described below.
HubiC
SVFS_TEST_HUBIC_AUTH
SVFS_TEST_HUBIC_TOKEN
OpenRC
SVFS_TEST_AUTH_URL
SVFS_TEST_USERNAME
SVFS_TEST_PASSWORD
SVFS_TEST_TENANT_NAME
SVFS_TEST_REGION_NAME
Token and storage URL
SVFS_TEST_AUTH_TOKEN
SVFS_TEST_STORAGE_URL
Execution
Run go test -v github.com/ovh/svfs/svfs.
Integration tests
Prerequisites
You must have Rake installed before running tests, you can install it using gem install rake.
Before running integration tests, you have to set 3 environment variables :
TEST_MOUNTPOINT: the svfs mountpoint.TEST_SEG_SIZE: segmented file size value (in megabytes).TEST_NSEG_SIZE: standard file size value (in megabytes).
A test container will be created automatically.
Execution
Use rake test command once you have followed previous instructions.
Writing more tests
At first, you must follow contribution guidelines of SVFS and use the latest version of go. All integration tests are located in the test directory. If you want to add some, you need consider the Rakefile and comment your tests like existing ones.