Beispiel #1
0
 def test_missing_boto3(self, import_boto3, console_error):
     import_boto3.side_effect = ImportError("no module named 'boto3'")
     with pytest.raises(ImportError, match="no module named 'boto3'"):
         net.download_from_bucket("s3", "s3://mybucket/data", "/tmp/data",
                                  None, None)
     console_error.assert_called_once_with(
         "S3 support is optional. Install it with `python -m pip install esrally[s3]`"
     )
Beispiel #2
0
    def test_download_from_gs_bucket(self, download, seed):
        random.seed(seed)
        expected_size = random.choice([None, random.randint(0, 1000)])
        progress_indicator = random.choice([None, "some progress indicator"])

        net.download_from_bucket("gs", "gs://unittest-gcp-bucket.test.org/data/documents.json.bz2", "/tmp/documents.json.bz2",
                                 expected_size, progress_indicator)
        download.assert_called_once_with("unittest-gcp-bucket.test.org", "data/documents.json.bz2",
                                         "/tmp/documents.json.bz2", expected_size, progress_indicator)
Beispiel #3
0
    def test_download_from_s3_bucket(self, download, seed):
        random.seed(seed)
        expected_size = random.choice([None, random.randint(0, 1000)])
        progress_indicator = random.choice([None, "some progress indicator"])

        net.download_from_bucket("s3", "s3://mybucket.elasticsearch.org/data/documents.json.bz2", "/tmp/documents.json.bz2",
                                 expected_size, progress_indicator)
        download.assert_called_once_with("mybucket.elasticsearch.org", "data/documents.json.bz2",
                                         "/tmp/documents.json.bz2", expected_size, progress_indicator)