Skip to content

Commit

Permalink
simplify asset smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Sep 24, 2024
1 parent eb7cdd9 commit b2c086c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
24 changes: 4 additions & 20 deletions Asset/tests/System/V1/AssetServiceSmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
*/
namespace Google\Cloud\Asset\Tests\System\V1;

use Google\Cloud\Asset\V1\Asset;
use Google\Cloud\Asset\V1\Client\AssetServiceClient;
use Google\Cloud\Asset\V1\ExportAssetsRequest;
use Google\Cloud\Asset\V1\GcsDestination;
use Google\Cloud\Asset\V1\OutputConfig;
use Google\Cloud\Asset\V1\ListAssetsRequest;
use Google\Cloud\Core\Testing\System\SystemTestCase;

/**
Expand All @@ -37,24 +36,9 @@ public function smokeTest()
if ($projectId === false) {
$this->fail('Environment variable PROJECT_ID must be set for smoke test');
}
$bucket = getenv('ASSET_TEST_BUCKET');
if ($bucket === false) {
$this->fail('Environment variable ASSET_TEST_BUCKET must be set for smoke test');
}
$client = new AssetServiceClient();
$objectPath = "gs://$bucket/cai-system-test";
$gcsDestination = new GcsDestination(['uri' => $objectPath]);
$outputConfig = new OutputConfig([
'gcs_destination' => $gcsDestination
]);
$request = new ExportAssetsRequest([
'parent' => "projects/$projectId",
'output_config' => $outputConfig
]);

$resp = $client->exportAssets($request);
$resp->pollUntilComplete();

$this->assertTrue($resp->operationSucceeded(), $resp->getError());
$response = $client->listAssets(ListAssetsRequest::build('projects/' . $projectId));
$this->assertInstanceOf(Asset::class, $response->getIterator()->current());
}
}
2 changes: 1 addition & 1 deletion Storage/tests/System/RequesterPaysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function setUpTestFixtures(): void

$requesterKeyFilePath = getenv('GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY_PATH');
if (!$requesterKeyFilePath) {
self::markTestSkipped('Set the GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY_PATH environment variable to run this test');
self::markTestSkipped('Set GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY_PATH to run this test');
}
$ownerKeyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
self::$requesterKeyFile = json_decode(file_get_contents($requesterKeyFilePath), true);
Expand Down

0 comments on commit b2c086c

Please sign in to comment.