Skip to content

Commit

Permalink
debug: try manual authentication for gcf
Browse files Browse the repository at this point in the history
  • Loading branch information
glasnt committed Dec 14, 2023
1 parent 963060c commit 098f81f
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion functions/helloworld_log/test/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@

namespace Google\Cloud\Samples\Functions\HelloLogging\Test;

use Google\Auth\ApplicationDefaultCredentials;
use Google\Cloud\TestUtils\DeploymentTrait;
use Google\Cloud\TestUtils\CloudFunctionDeploymentTrait;
use Google\Cloud\TestUtils\TestTrait;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/TestCasesTrait.php';
Expand All @@ -35,14 +40,32 @@
*/
class DeployTest extends TestCase
{
use CloudFunctionDeploymentTrait;
use DeploymentTrait;
use TestCasesTrait;
use CloudFunctionDeploymentTrait;
use TestTrait;

private static $entryPoint = 'helloLogging';

public function testFunction(): void
{
foreach (self::cases() as $test) {

$targetAudience = self::getBaseUri();
// create middleware
$middleware = ApplicationDefaultCredentials::getIdTokenMiddleware($targetAudience);
$stack = HandlerStack::create();
$stack->push($middleware);

// create the HTTP client
$client = new Client([
'handler' => $stack,
'auth' => 'google_auth',
'base_uri' => $targetAudience,
]);



// Send a request to the function.
$resp = $this->client->get('');

Expand Down

0 comments on commit 098f81f

Please sign in to comment.