Skip to content

Commit

Permalink
fix redis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Sep 27, 2024
1 parent 557e69c commit 56c8bab
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions Redis/tests/System/V1/CloudRedisClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@
*/
class CloudRedisClientTest extends TestCase
{
protected $grpcClient;
protected $projectId;

public function setUp(): void
{
$keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
$keyFileData = json_decode(file_get_contents($keyFilePath), true);

self::$grpcClient = new CloudRedisClient([
'credentials' => $keyFilePath,
'transport' => 'grpc'
]);

self::$projectId = $keyFileData['project_id'];
}

private function deleteInstance(CloudRedisClient $client, $instanceToDelete)
{
$operationResponse = $client->deleteInstance(
Expand Down Expand Up @@ -100,16 +84,22 @@ private function createRedisInstance(CloudRedisClient $client, $parent, $instanc
return $result->getName();
}

/**
* @dataProvider clientProvider
*/
public function testCreateListDeleteOperations()
{
$client = self::$grpcClient;
$keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
$keyFileData = json_decode(file_get_contents($keyFilePath), true);
$projectId = $keyFileData['project_id'];

$client = new CloudRedisClient([
'credentials' => $keyFilePath,
'transport' => 'grpc'
]);

$locationId = 'us-central1';
$instanceId = 'my-redis-test-instance';
$parent = $client::locationName(self::$projectId, $locationId);
$instanceName = $client::instanceName(self::$projectId, $locationId, $instanceId);

$parent = $client::locationName($projectId, $locationId);
$instanceName = $client::instanceName($projectId, $locationId, $instanceId);
$request = ListInstancesRequest::build($parent);

$instances = $client->listInstances($request);
Expand Down

0 comments on commit 56c8bab

Please sign in to comment.