Requirements:
-
Install Docker:
The Integration Tests script starts a MinIO container on your local machine (port 9000) to be used as store during tests execution.
-
[Optional] Install and configure Make to run tests easily:
-
Configure git:
git config --global user.name "First Name and Last Name"git config --global user.email "your_name@example.com"
Execute on terminal:
cd ml-git
make test.unitLinux:
Execute on terminal:
cd ml-git
sh ./scripts/run_unit_tests.shWindows:
Execute on Powershell or CMD:
cd ml-git
.\scripts\run_unit_tests.batExecute on terminal:
cd ml-git
make test.integration Linux:
Execute on terminal:
cd ml-git
sh ./scripts/run_integration_tests.shWindows:
Execute on Powershell or CMD:
cd ml-git
.\scripts\run_integration_tests.batTo run google drive integration test you need to:
-
Create directory tests/integration/credentials-json
-
Put your credentials file with name credentials.json in the folder you created in step 1
Example of credentials.json:
{"installed":{"client_id":"fake_client_id ","project_id":"project","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"fake_client_secret ","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}} -
Create a folder with name mlgit/test-folder in your GDrive
-
Create files mlgit/B and mlgit/test-folder/A with any content, make sure that files aren't Google Files.
You should have the following structure in your drive:
YourDrive | ├── mlgit │ ├── B │ └── test-folder │ └── A -
Create tests/integration/gdrive-files-links.json with shared links of mlgit/B and mlgit/test-folder.
Example of gdrive-files-links.json:
{ "test-folder": "https://drive.google.com/drive/folders/1MvWrQtPVDuJ5-XB82dMwRI8XflBZ?usp=sharing", "B": "https://drive.google.com/file/d/1uy6Kao8byRqTPv-Plw8tuhITyh5N1Uua/view?usp=sharing" }
The Google Drive Integration Tests are set to not run by default (as they require extra setup, as mentioned earlier). To include the integration tests for Google Drive store during an integration tests run, you should execute:
Execute on terminal:
cd ml-git
make test.integration.gdriveLinux:
Execute on terminal:
cd ml-git
sh ./scripts/run_integration_tests.sh --gdriveWindows:
Execute on Powershell or CMD:
cd ml-git
.\scripts\run_integration_tests.bat --gdriveTo execute a specific integration tests file, execute the run_integration_tests script accordingly with your operating system and pass the test file path relative to integration tests folder (tests/integration/).
See the below examples running test_01_init.py located at ml-git/tests/integration/test_01_init.py:
Linux:
cd ml-git
sh ./scripts/run_integration_tests.sh test_01_init.pyWindows:
cd ml-git
.\scripts\run_integration_tests.bat test_01_init.py