Skip to content

Commit

Permalink
resolve system tests issues of CacheSessionPool
Browse files Browse the repository at this point in the history
  • Loading branch information
ajupazhamayil committed May 15, 2024
1 parent 0966a99 commit 5b9841d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Spanner/src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
use Google\Cloud\Spanner\V1\TypeCode;
use Google\Protobuf\FieldMask;
use Google\Rpc\Code;
use GuzzleHttp\Promise\PromiseInterface;

/**
* Represents a Cloud Spanner Database.
Expand Down Expand Up @@ -2237,7 +2238,6 @@ public function batchCreateSessions(array $options)
public function deleteSessionAsync(array $options)
{
list($data, $optionalArgs) = $this->splitOptionalArgs($options);
$data['name'] = $this->name;
return $this->createAndSendRequest(
GapicSpannerClient::class,
'deleteSessionAsync',
Expand Down
5 changes: 3 additions & 2 deletions Spanner/src/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ public function executeUpdate(
if (!isset($options['transaction']['begin'])) {
$options['transaction'] = ['id' => $transaction->id()];
}
$statsItem = $this->pluck('statsItem', $options, false);
$res = $this->execute($session, $sql, $options);
if (empty($transaction->id()) && $res->transaction()) {
$transaction->setId($res->transaction()->id());
Expand All @@ -412,7 +413,7 @@ public function executeUpdate(
);
}

$statsItem = $options['statsItem'] ?? 'rowCountExact';
$statsItem = $statsItem ?? 'rowCountExact';

return $stats[$statsItem];
}
Expand Down Expand Up @@ -601,7 +602,7 @@ public function transaction(Session $session, array $options = [])
'requestOptions' => [],
'singleUse' => false
];
$isRetry = $options['isRetry'] ?? false;
$isRetry = $this->pluck('isRetry', $options, false) ?? false;
$transactionTag = $this->pluck('tag', $options, false);

if (isset($transactionTag)) {
Expand Down
4 changes: 2 additions & 2 deletions Spanner/tests/System/ReadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public function testReadWithLimit()
};

$limitCount = count(iterator_to_array($res(10)));
$unlimitCount = count(iterator_to_array($res(null)));
$unlimitCount = count(iterator_to_array($res(0)));

$this->assertEquals(10, $limitCount);
$this->assertNotEquals($limitCount, $unlimitCount);
Expand All @@ -368,7 +368,7 @@ public function testReadOverIndexWithLimit()
};

$limitCount = count(iterator_to_array($res(10)));
$unlimitCount = count(iterator_to_array($res(null)));
$unlimitCount = count(iterator_to_array($res(0)));

$this->assertEquals(10, $limitCount);
$this->assertNotEquals($limitCount, $unlimitCount);
Expand Down

0 comments on commit 5b9841d

Please sign in to comment.