Skip to content

Commit

Permalink
add back storage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Sep 24, 2024
1 parent 186fd65 commit 1c80851
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ jobs:
- name: Save secrets to file
run: |
echo "${{ secrets.GOOGLE_CLOUD_PHP_TESTS_KEY }}" | base64 -d > ${{ runner.temp }}/service-account.json
echo "${{ secrets.GOOGLE_CLOUD_PHP_WHITELIST_TESTS_KEY }}" | base64 -d > ${{ runner.temp }}/service-account.whitelist.json
echo "${{ secrets.GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY }}" | base64 -d > ${{ runner.temp }}/service-account.firestore.json
- name: Install dependencies
run: composer --no-interaction --no-ansi --no-progress update
- name: Run System Tests
run: vendor/bin/phpunit -c phpunit-system.xml.dist --testdox --colors=always
env:
GOOGLE_CLOUD_PHP_TESTS_KEY_PATH: ${{ runner.temp }}/service-account.json
# GOOGLE_CLOUD_PHP_WHITELIST_TESTS_KEY_PATH: ${{ runner.temp }}/service-account.whitelist.json
# GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY_PATH: ${{ runner.temp }}/service-account.firestore.json
2 changes: 1 addition & 1 deletion Asset/tests/System/V1/AssetServiceSmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public function smokeTest()
$resp = $client->exportAssets($request);
$resp->pollUntilComplete();

$this->assertTrue($resp->operationSucceeded());
$this->assertTrue($resp->operationSucceeded(), $resp->getError());
}
}
20 changes: 10 additions & 10 deletions Storage/tests/System/SignedUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function signedUrls()
public function testSignedUrlV2($objectName, array $urlOpts = [])
{
$urlOpts += [
'version' => 'v2'
'force_ip_resolve' => 'v2'
];

$obj = $this->createFile($objectName);
Expand All @@ -95,7 +95,7 @@ public function testSignedUrlV2($objectName, array $urlOpts = [])
public function testSignedUrlV4($objectName, array $urlOpts = [])
{
$urlOpts += [
'version' => 'v4'
'force_ip_resolve' => 'v4'
];

$obj = $this->createFile($objectName);
Expand All @@ -118,7 +118,7 @@ public function testSignedUrlDelete($version)
$url = $obj->signedUrl($ts, [
'method' => 'DELETE',
'contentType' => 'text/plain',
'version' => $version
'force_ip_resolve' => $version
]);

try {
Expand All @@ -142,7 +142,7 @@ public function testSignedUploadSession($version)
{
$obj = self::$bucket->object(uniqid(self::TESTING_PREFIX) .'.txt');
$url = $obj->beginSignedUploadSession([
'version' => $version
'force_ip_resolve' => $version
]);

$this->guzzle->request('PUT', $url, [
Expand All @@ -166,7 +166,7 @@ public function testSignedUploadSessionOrigin($version)

$url = $obj->beginSignedUploadSession([
'origin' => 'https://google.com',
'version' => $version,
'force_ip_resolve' => $version,
'headers' => [
'x-goog-test' => 'hi'
]
Expand All @@ -181,7 +181,7 @@ public function testSignedUploadSessionOrigin($version)

$this->guzzle->request('PUT', $url, [
'body' => self::CONTENT,
'version' => $version,
'force_ip_resolve' => $version,
'headers' => [
'x-goog-test' => 'hi'
]
Expand All @@ -205,7 +205,7 @@ public function testSignedUrlContentType($version)
$url = $obj->signedUrl(time() + 2, [
'responseDisposition' => $disposition,
'responseType' => $contentType,
'version' => $version
'force_ip_resolve' => $version
]);

$res = $this->guzzle->request('GET', $url);
Expand All @@ -225,7 +225,7 @@ public function testSignedUrlWithSaveAsName($version)
$saveAs = 'foo bar';
$url = $obj->signedUrl(time() + 2, [
'saveAsName' => $saveAs,
'version' => $version
'force_ip_resolve' => $version
]);

$res = $this->guzzle->request('GET', $url);
Expand All @@ -240,7 +240,7 @@ public function testSignedUrlWithSaveAsName($version)
public function testBucketUrlSigning($version)
{
$url = self::$bucket->signedUrl(time() + 2, [
'version' => $version
'force_ip_resolve' => $version
]);

$res = $this->guzzle->request('GET', $url);
Expand Down Expand Up @@ -270,7 +270,7 @@ private function createFile($name)
private function getFile($url, array $options = [])
{
$res = $this->guzzle->request('GET', $url, $options + [
'http_errors' => false
'http_errors' => false,
]);

return (string) $res->getBody();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public static function setUpTestFixtures(): void
public static function tearDownTestFixtures(): void
{
self::$client->unregisterStreamWrapper();
parent::tearDownTestFixtures();
}

protected static function generateUrl($file, Bucket $bucket = null)
Expand Down
2 changes: 1 addition & 1 deletion Storage/tests/System/StreamWrapper/UrlStatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testStatOnOpenFileForRead()
{
$fd = fopen(self::$fileUrl, 'r');
$stat = fstat($fd);
$this->assertEquals(33206, $stat['mode']);
$this->assertEquals(33060, $stat['mode']);
}

public function testIsWritable()
Expand Down
5 changes: 1 addition & 4 deletions phpunit-system.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<testsuites>
<testsuite name="System Test Suite">
<directory>*/tests/System</directory>
<!-- Exclude Storage system tests for now because they're failing -->
<!-- @TODO: fix storage system tests -->
<exclude>Storage/tests/System</exclude>
<!-- Exclude tests which have emulator tests -->
<!-- Exclude tests which have emulator tests (for now) -->
<exclude>Datastore/tests/System</exclude>
<exclude>Firestore/tests/System</exclude>
<exclude>Logging/tests/System</exclude>
Expand Down

0 comments on commit 1c80851

Please sign in to comment.