| Index: gslib/tests/test_perfdiag.py
|
| ===================================================================
|
| --- gslib/tests/test_perfdiag.py (revision 33376)
|
| +++ gslib/tests/test_perfdiag.py (working copy)
|
| @@ -1,3 +1,4 @@
|
| +# -*- coding: utf-8 -*-
|
| # Copyright 2013 Google Inc. All Rights Reserved.
|
| #
|
| # Licensed under the Apache License, Version 2.0 (the "License");
|
| @@ -11,7 +12,10 @@
|
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| # See the License for the specific language governing permissions and
|
| # limitations under the License.
|
| +"""Integration tests for perfdiag command."""
|
|
|
| +from __future__ import absolute_import
|
| +
|
| import socket
|
|
|
| import gslib.tests.testcase as testcase
|
| @@ -19,6 +23,7 @@
|
| from gslib.tests.util import unittest
|
| from gslib.util import IS_WINDOWS
|
|
|
| +
|
| class TestPerfDiag(testcase.GsUtilIntegrationTestCase):
|
| """Integration tests for perfdiag command."""
|
|
|
| @@ -30,13 +35,15 @@
|
| _custom_endpoint_flags = [
|
| '-o', 'Credentials:gs_host=' + _gs_ip,
|
| '-o', 'Credentials:gs_host_header=storage.googleapis.com',
|
| + # TODO: gsutil-beta: Add host header support for JSON
|
| '-o', 'Boto:https_validate_certificates=False']
|
|
|
| def test_latency(self):
|
| bucket_uri = self.CreateBucket()
|
| cmd = ['perfdiag', '-n', '1', '-t', 'lat', suri(bucket_uri)]
|
| self.RunGsUtil(cmd)
|
| - self.RunGsUtil(self._custom_endpoint_flags + cmd)
|
| + if self.test_api == 'XML':
|
| + self.RunGsUtil(self._custom_endpoint_flags + cmd)
|
|
|
| def _run_basic_wthru_or_rthru(self, test_name, num_processes, num_threads):
|
| bucket_uri = self.CreateBucket()
|
| @@ -44,8 +51,12 @@
|
| '-s', '1024', '-c', str(num_processes),
|
| '-k', str(num_threads), '-t', test_name, suri(bucket_uri)]
|
| self.RunGsUtil(cmd)
|
| - self.RunGsUtil(self._custom_endpoint_flags + cmd)
|
| + if self.test_api == 'XML':
|
| + self.RunGsUtil(self._custom_endpoint_flags + cmd)
|
|
|
| + def test_write_throughput_single_process_single_thread(self):
|
| + self._run_basic_wthru_or_rthru('wthru', 1, 1)
|
| +
|
| def test_write_throughput_single_process_multi_thread(self):
|
| self._run_basic_wthru_or_rthru('wthru', 1, 2)
|
|
|
| @@ -57,6 +68,9 @@
|
| def test_write_throughput_multi_process_multi_thread(self):
|
| self._run_basic_wthru_or_rthru('wthru', 2, 2)
|
|
|
| + def test_read_throughput_single_process_single_thread(self):
|
| + self._run_basic_wthru_or_rthru('rthru', 1, 1)
|
| +
|
| def test_read_throughput_single_process_multi_thread(self):
|
| self._run_basic_wthru_or_rthru('rthru', 1, 2)
|
|
|
| @@ -86,3 +100,10 @@
|
| ['perfdiag', '-n', '1', '-s', '3pb', '-t', 'wthru', 'gs://foobar'],
|
| expected_status=1, return_stderr=True)
|
| self.assertIn('Maximum throughput file size', stderr)
|
| +
|
| + def test_listing(self):
|
| + bucket_uri = self.CreateBucket()
|
| + stdout = self.RunGsUtil(
|
| + ['perfdiag', '-n', '1', '-t', 'list', suri(bucket_uri)],
|
| + return_stdout=True)
|
| + self.assertIn('Number of listing calls made:', stdout)
|
|
|