|
20 | 20 | use Google\Cloud\Spanner\SpannerClient; |
21 | 21 | use Google\Cloud\Spanner\Instance; |
22 | 22 | use Google\Cloud\TestUtils\ExecuteCommandTrait; |
| 23 | +use Google\Cloud\TestUtils\EventuallyConsistentTestTrait; |
23 | 24 | use Google\Cloud\TestUtils\TestTrait; |
24 | 25 | use PHPUnit\Framework\TestCase; |
25 | 26 |
|
26 | 27 | class spannerTest extends TestCase |
27 | 28 | { |
28 | | - use TestTrait, ExecuteCommandTrait { |
| 29 | + use TestTrait, EventuallyConsistentTestTrait, ExecuteCommandTrait { |
29 | 30 | ExecuteCommandTrait::runCommand as traitRunCommand; |
30 | 31 | } |
31 | 32 |
|
@@ -61,11 +62,6 @@ public static function setUpBeforeClass() |
61 | 62 | self::$instance = $spanner->instance(self::$instanceId); |
62 | 63 | } |
63 | 64 |
|
64 | | - public function setUp() |
65 | | - { |
66 | | - $this->useExpectationFailedBackoff(); |
67 | | - } |
68 | | - |
69 | 65 | public function testCreateDatabase() |
70 | 66 | { |
71 | 67 | $output = $this->runCommand('create-database'); |
@@ -573,11 +569,13 @@ public function testQueryDataWithStringParameter() |
573 | 569 | */ |
574 | 570 | public function testQueryDataWithTimestampParameter() |
575 | 571 | { |
576 | | - $output = $this->runCommand('query-data-with-timestamp-parameter'); |
577 | | - self::$lastUpdateDataTimestamp = time(); |
578 | | - $this->assertContains('VenueId: 4, VenueName: Venue 4, LastUpdateTime:', $output); |
579 | | - $this->assertContains('VenueId: 19, VenueName: Venue 19, LastUpdateTime:', $output); |
580 | | - $this->assertContains('VenueId: 42, VenueName: Venue 42, LastUpdateTime:', $output); |
| 572 | + $this->runEventuallyConsistentTest(function () { |
| 573 | + $output = $this->runCommand('query-data-with-timestamp-parameter'); |
| 574 | + self::$lastUpdateDataTimestamp = time(); |
| 575 | + $this->assertContains('VenueId: 4, VenueName: Venue 4, LastUpdateTime:', $output); |
| 576 | + $this->assertContains('VenueId: 19, VenueName: Venue 19, LastUpdateTime:', $output); |
| 577 | + $this->assertContains('VenueId: 42, VenueName: Venue 42, LastUpdateTime:', $output); |
| 578 | + }); |
581 | 579 | } |
582 | 580 |
|
583 | 581 | private function runCommand($commandName) |
|
0 commit comments