From a6d46715dbb3331a2f0daaba814d1d984d8752e5 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Tue, 11 Oct 2016 11:12:18 -0700 Subject: [PATCH] Use EventuallyConsistentTestTrait for a test --- logging/api/composer.json | 3 +- logging/api/composer.lock | 353 ++++++++++++++++++-- logging/api/test/ListEntriesCommandTest.php | 19 +- 3 files changed, 332 insertions(+), 43 deletions(-) diff --git a/logging/api/composer.json b/logging/api/composer.json index a9463916db..affa23ec0e 100644 --- a/logging/api/composer.json +++ b/logging/api/composer.json @@ -4,7 +4,8 @@ "symfony/console": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.8", + "google/cloud-tools": "<2.0" }, "autoload": { "psr-4": { "Google\\Cloud\\Samples\\Logging\\": "src" }, diff --git a/logging/api/composer.lock b/logging/api/composer.lock index 807e86b1bc..5c4d6952fb 100644 --- a/logging/api/composer.lock +++ b/logging/api/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8c40a60bb0bd40dc993d634492cd26ef", - "content-hash": "5b9ba84751f14bb62d2a7eb5ab1d3878", + "hash": "28c584b682fd3adc868c8bfa44b2ab7c", + "content-hash": "cfd7fd7fe27a51e36105b8ba75b306e7", "packages": [ { "name": "firebase/php-jwt", @@ -100,16 +100,16 @@ }, { "name": "google/cloud", - "version": "v0.8.0", + "version": "v0.10.2", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", - "reference": "79a765fdcb2be9e756f8bf9283ad3626cd2f61d4" + "reference": "97d06b1106ee9bca591ad0573ee71e32a8500992" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/79a765fdcb2be9e756f8bf9283ad3626cd2f61d4", - "reference": "79a765fdcb2be9e756f8bf9283ad3626cd2f61d4", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/97d06b1106ee9bca591ad0573ee71e32a8500992", + "reference": "97d06b1106ee9bca591ad0573ee71e32a8500992", "shasum": "" }, "require": { @@ -122,12 +122,14 @@ "rize/uri-template": "~0.3" }, "require-dev": { + "erusev/parsedown": "^1.6", "james-heinrich/getid3": "^1.9", "league/json-guard": "^0.3", - "phpdocumentor/phpdocumentor": "2.8.*", + "phpdocumentor/reflection": "^3.0", "phpunit/phpunit": "4.8.*", "squizlabs/php_codesniffer": "2.*", - "symfony/console": "2.*" + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" }, "suggest": { "google/gax": "Required to support gRPC", @@ -178,20 +180,20 @@ "translate", "vision" ], - "time": "2016-09-09 14:17:08" + "time": "2016-10-11 17:58:10" }, { "name": "guzzlehttp/guzzle", - "version": "6.2.1", + "version": "6.2.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", - "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", "shasum": "" }, "require": { @@ -240,7 +242,7 @@ "rest", "web service" ], - "time": "2016-07-15 17:22:37" + "time": "2016-10-08 15:01:37" }, { "name": "guzzlehttp/promises", @@ -527,22 +529,30 @@ }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -556,12 +566,13 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2016-10-10 12:19:37" }, { "name": "rize/uri-template", @@ -609,20 +620,21 @@ }, { "name": "symfony/console", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8ea494c34f0f772c3954b5fbe00bffc5a435e563" + "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8ea494c34f0f772c3954b5fbe00bffc5a435e563", - "reference": "8ea494c34f0f772c3954b5fbe00bffc5a435e563", + "url": "https://api.github.com/repos/symfony/console/zipball/6cb0872fb57b38b3b09ff213c21ed693956b9eb0", + "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0", "shasum": "" }, "require": { "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { @@ -665,7 +677,64 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-08-19 06:48:39" + "time": "2016-09-28 00:11:12" + }, + { + "name": "symfony/debug", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/e2b3f74a67fc928adc3c1b9027f73e1bc01190a8", + "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-09-06 11:02:40" }, { "name": "symfony/polyfill-mbstring", @@ -782,6 +851,56 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "google/cloud-tools", + "version": "v0.5.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/php-tools.git", + "reference": "79317583835061e4f4bf981376be84c41a4f4534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/php-tools/zipball/79317583835061e4f4bf981376be84c41a4f4534", + "reference": "79317583835061e4f4bf981376be84c41a4f4534", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "~5.3|~6.0", + "php": ">=5.5", + "phpunit/phpunit": "~4|~5", + "symfony/browser-kit": "~2|~3", + "symfony/process": "~2|~3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\TestUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Takashi Matsuo", + "email": "tmatsuo@google.com", + "homepage": "https://wp.gaeflex.ninja/" + } + ], + "description": "PHP tools for Google Cloud Platform", + "homepage": "https://github.com/GoogleCloudPlatform/php-tools", + "keywords": [ + "appengine", + "gcp", + "test" + ], + "time": "2016-10-07 22:03:44" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", @@ -838,16 +957,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { @@ -879,7 +998,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-06-10 09:48:41" + "time": "2016-09-30 07:12:33" }, { "name": "phpdocumentor/type-resolver", @@ -1733,18 +1852,180 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, + { + "name": "symfony/browser-kit", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/browser-kit.git", + "reference": "901319a31c9b3cee7857b4aeeb81b5d64dfa34fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/901319a31c9b3cee7857b4aeeb81b5d64dfa34fc", + "reference": "901319a31c9b3cee7857b4aeeb81b5d64dfa34fc", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/dom-crawler": "~2.8|~3.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\BrowserKit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "https://symfony.com", + "time": "2016-09-06 11:02:40" + }, + { + "name": "symfony/dom-crawler", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "bb7395e8b1db3654de82b9f35d019958276de4d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/bb7395e8b1db3654de82b9f35d019958276de4d7", + "reference": "bb7395e8b1db3654de82b9f35d019958276de4d7", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2016-08-05 08:37:39" + }, + { + "name": "symfony/process", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "66de154ae86b1a07001da9fbffd620206e4faf94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94", + "reference": "66de154ae86b1a07001da9fbffd620206e4faf94", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2016-09-29 14:13:09" + }, { "name": "symfony/yaml", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d" + "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d", - "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/368b9738d4033c8b93454cb0dbd45d305135a6d3", + "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3", "shasum": "" }, "require": { @@ -1780,7 +2061,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-09-02 02:12:52" + "time": "2016-09-25 08:27:07" }, { "name": "webmozart/assert", diff --git a/logging/api/test/ListEntriesCommandTest.php b/logging/api/test/ListEntriesCommandTest.php index 8454b6a289..2d46e4aca0 100644 --- a/logging/api/test/ListEntriesCommandTest.php +++ b/logging/api/test/ListEntriesCommandTest.php @@ -19,6 +19,7 @@ use Google\Cloud\Samples\Logging\ListEntriesCommand; use Google\Cloud\Samples\Logging\WriteCommand; +use Google\Cloud\TestUtils\EventuallyConsistentTestTrait; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; @@ -27,6 +28,8 @@ */ class ListEntriesCommandTest extends \PHPUnit_Framework_TestCase { + use EventuallyConsistentTestTrait; + /* @var $hasCredentials boolean */ protected static $hasCredentials; /* @var $projectId mixed|string */ @@ -59,7 +62,6 @@ public function setUp() ], ['interactive' => false] ); - sleep(2); } public function testListEntries() @@ -67,10 +69,15 @@ public function testListEntries() $application = new Application(); $application->add(new ListEntriesCommand()); $commandTester = new CommandTester($application->get('list-entries')); - $commandTester->execute( - ['--project' => $this->projectId, '--logger' => 'my_test_logger'], - ['interactive' => false] - ); - $this->expectOutputRegex('/: Test Message/'); + $this->runEventuallyConsistentTest(function() use ($commandTester) { + $commandTester->execute( + [ + '--project' => $this->projectId, + '--logger' => 'my_test_logger' + ], + ['interactive' => false] + ); + $this->expectOutputRegex('/: Test Message/'); + }); } }